package gapr_test import ( "testing" "code.icb4dc0.de/prskr/gapr" ) func TestKeyMappers(t *testing.T) { t.Parallel() tests := []struct { name string mapper gapr.KeyMapper input string want string }{ { name: "Empty string", mapper: gapr.CamelCaseKeyMapper, input: "", want: "", }, { name: "HelloWorld camel case", mapper: gapr.CamelCaseKeyMapper, input: "HelloWorld", want: "helloWorld", }, { name: "helloWorld camel case", mapper: gapr.CamelCaseKeyMapper, input: "helloWorld", want: "helloWorld", }, { name: "h camel case", mapper: gapr.CamelCaseKeyMapper, input: "h", want: "h", }, { name: "HelloWorld lowercase", mapper: gapr.LowercaseKeyMapper, input: "HelloWorld", want: "helloworld", }, { name: "HelloWorld uppercase", mapper: gapr.UppercaseKeyMapper, input: "HelloWorld", want: "HELLOWORLD", }, { name: "HelloWorld pascal case", mapper: gapr.PascalCaseKeyMapper, input: "helloWorld", want: "HelloWorld", }, { name: "h pascal case", mapper: gapr.PascalCaseKeyMapper, input: "h", want: "H", }, } for _, tc := range tests { tt := tc t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := tt.mapper.MapKey(tt.input); got != tt.want { t.Errorf("Expected %s but got %s", tt.want, got) } }) } }