Fix encode/decode for []bool
[govpp.git] / binapigen / binapigen_test.go
index 2fbd163..0352635 100644 (file)
@@ -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)
+                       }
+               })
+       }
+}