yaml_test.go 373 B

12345678910111213141516171819202122232425
  1. package monitor
  2. import (
  3. "testing"
  4. "gopkg.in/yaml.v3"
  5. )
  6. var testYaml = `
  7. - time: 2023-03-22T10:00:00Z
  8. path: live/test
  9. - time: 2023-03-22T12:00:00Z
  10. path: live/test2
  11. `
  12. func TestYaml(t *testing.T) {
  13. t.Run(t.Name(), func(t *testing.T) {
  14. var index []Index
  15. err := yaml.Unmarshal([]byte(testYaml), &index)
  16. if err != nil {
  17. t.Fatal(err)
  18. }
  19. t.Log(index)
  20. })
  21. }