diff options
Diffstat (limited to 'client/go/script-utils/logfmt/internal_test.go')
-rw-r--r-- | client/go/script-utils/logfmt/internal_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/client/go/script-utils/logfmt/internal_test.go b/client/go/script-utils/logfmt/internal_test.go new file mode 100644 index 00000000000..9b6b0f8404c --- /dev/null +++ b/client/go/script-utils/logfmt/internal_test.go @@ -0,0 +1,34 @@ +package logfmt + +import ( + "bufio" + "os" + "testing" +) + +// tests: func isInternal(componentName string) bool + +func TestIsInternal(t *testing.T) { + f, err := os.Open("internal_names.txt") + if err != nil { + t.Fatal("could not read test data") + } + defer f.Close() + for input := bufio.NewScanner(f); input.Scan(); { + if name := input.Text(); !isInternal(name) { + t.Logf("name '%s' should be internal but was not recognized", name) + t.Fail() + } + } + f, err = os.Open("internal_notnames.txt") + if err != nil { + t.Fatal("could not read test data") + } + defer f.Close() + for input := bufio.NewScanner(f); input.Scan(); { + if name := input.Text(); isInternal(name) { + t.Logf("name '%s' should not be internal but was recognized", name) + t.Fail() + } + } +} |