package yamlfmt import ( "fmt" "testing" ) func TestIgnorer(t *testing.T) { dir := "testdata" ignorer, err := NewIgnorer(dir) if err != nil { t.Fatal(err) } pathTests := map[string]bool{ "configmap.yaml": true, "allyaml/configmap4.yaml": true, "allyaml/configmap.yaml": true, "nest1/nest2/deployment.yaml": true, "nest1/nest2/another.yaml": false, "bunk.yaml": false, "direct_path/tester.yaml": true, // Testing test fail below // "allyaml/configmap3.yaml": false, } for path, expected := range pathTests { ignoreCheck := ignorer.IgnorePath(path) fmt.Printf("%s test: expected: %t got %t\n", path, expected, ignoreCheck) if expected != ignoreCheck { t.Errorf("%s failed to ignore", path) } } }