summaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/definitions_test.go
blob: 30c85ae334b14288974d274abb0982066182b9a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
			}
		})
	}
}