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))
})
}
}
+
+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)
+ }
+ })
+ }
+}