aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/definitions_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/binapi-generator/definitions_test.go')
-rw-r--r--cmd/binapi-generator/definitions_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmd/binapi-generator/definitions_test.go b/cmd/binapi-generator/definitions_test.go
new file mode 100644
index 0000000..30c85ae
--- /dev/null
+++ b/cmd/binapi-generator/definitions_test.go
@@ -0,0 +1,25 @@
+package main
+
+import (
+ "testing"
+)
+
+func TestInitialism(t *testing.T) {
+ tests := []struct {
+ name string
+ input string
+ expOutput string
+ }{
+ {name: "id", input: "id", expOutput: "ID"},
+ {name: "ipv6", input: "is_ipv6", expOutput: "IsIPv6"},
+ {name: "ip6", input: "is_ip6", expOutput: "IsIP6"},
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ output := camelCaseName(test.input)
+ if output != test.expOutput {
+ t.Errorf("expected %q, got %q", test.expOutput, output)
+ }
+ })
+ }
+}