X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=binapigen%2Fbinapigen_test.go;h=0352635f410e0a769e5fa334faf9c2f75b6f91cf;hb=5de7f6b85458615fa592a335d45c546397f32c9a;hp=2fbd163eab1c8d028c4f1352fb0a5c82d9f9b2c5;hpb=d1f24d37bd447b64e402298bb8eb2479681facf9;p=govpp.git diff --git a/binapigen/binapigen_test.go b/binapigen/binapigen_test.go index 2fbd163..0352635 100644 --- a/binapigen/binapigen_test.go +++ b/binapigen/binapigen_test.go @@ -40,11 +40,11 @@ func TestGenerator(t *testing.T) { t.Run(test.name, func(t *testing.T) { RegisterTestingT(t) - apifiles := []*vppapi.File{test.file} + apiFiles := []*vppapi.File{test.file} gen, err := New(Options{ ImportPrefix: "test", - }, apifiles, nil) + }, apiFiles, nil) Expect(err).ToNot(HaveOccurred(), "unexpected generator error: %v", err) Expect(gen.Files).To(HaveLen(1)) @@ -53,3 +53,20 @@ func TestGenerator(t *testing.T) { }) } } + +func TestSanitize(t *testing.T) { + tests := []struct { + name string + expected string + }{ + {"interface", "interfaces"}, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + s := sanitizedName(test.name) + if s != test.expected { + t.Fatalf("expected: %q, got: %q", test.expected, s) + } + }) + } +}