Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions render/render_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func TestRenderTemplate(t *testing.T) {
{"Floor test: {{ .Foo | floor }}", map[string]interface{}{"Foo": "0.45"}, options.ExitWithError, "", "Floor test: 0", false},
{"Dasherize test: {{ .Foo | dasherize }}", map[string]interface{}{"Foo": "foo BAR baz!"}, options.ExitWithError, "", "Dasherize test: foo-bar-baz", false},
{"Snake case test: {{ .Foo | snakeCase }}", map[string]interface{}{"Foo": "foo BAR baz!"}, options.ExitWithError, "", "Snake case test: foo_bar_baz", false},
{"Camel case test: {{ .Foo | camelCase }}", map[string]interface{}{"Foo": "foo BAR baz!"}, options.ExitWithError, "", "Camel case test: FooBARBaz", false},
{"Camel case lower test: {{ .Foo | camelCaseLower }}", map[string]interface{}{"Foo": "foo BAR baz!"}, options.ExitWithError, "", "Camel case lower test: fooBARBaz", false},
{"Camel case test: {{ .Foo | camelCase }}", map[string]interface{}{"Foo": "foo BAR baz!"}, options.ExitWithError, "", "Camel case test: FooBarBaz", false},
{"Camel case lower test: {{ .Foo | camelCaseLower }}", map[string]interface{}{"Foo": "foo BAR baz!"}, options.ExitWithError, "", "Camel case lower test: fooBarBaz", false},
{"Plus test: {{ plus .Foo .Bar }}", map[string]interface{}{"Foo": "5", "Bar": "3"}, options.ExitWithError, "", "Plus test: 8", false},
{"Minus test: {{ minus .Foo .Bar }}", map[string]interface{}{"Foo": "5", "Bar": "3"}, options.ExitWithError, "", "Minus test: 2", false},
{"Times test: {{ times .Foo .Bar }}", map[string]interface{}{"Foo": "5", "Bar": "3"}, options.ExitWithError, "", "Times test: 15", false},
Expand Down
2 changes: 1 addition & 1 deletion render/template_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ func camelCase(str string) string {
// Capitalize each word
capitalized := []string{}
for _, word := range words {
capitalized = append(capitalized, strings.Title(word))
capitalized = append(capitalized, strings.Title(strings.ToLower(word)))
}

// Join everything back together into a string
Expand Down
48 changes: 24 additions & 24 deletions render/template_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,20 @@ func TestCamelCase(t *testing.T) {
{"", ""},
{" ", ""},
{"foo", "Foo"},
{"FOO", "FOO"},
{"FOO", "Foo"},
{" \t foo \t", "Foo"},
{"FooBarBaz", "FooBarBaz"},
{"FooBarBaz", "Foobarbaz"},
{"Fo", "Fo"},
{"fooID", "FooID"},
{"FoB", "FoB"},
{"oFo", "OFo"},
{"FoBa", "FoBa"},
{"oFoBa", "OFoBa"},
{"oFoB", "OFoB"},
{"Foo123B1234Baz1234", "Foo123B1234Baz1234"},
{"fooID", "Fooid"},
{"FoB", "Fob"},
{"oFo", "Ofo"},
{"FoBa", "Foba"},
{"oFoBa", "Ofoba"},
{"oFoB", "Ofob"},
{"Foo123B1234Baz1234", "Foo123b1234baz1234"},
{"Foo_Bar_Baz", "FooBarBaz"},
{"FooIDbarBaz", "FooIDbarBaz"},
{"FOOIDbarBaz", "FOOIDbarBaz"},
{"FooIDbarBaz", "Fooidbarbaz"},
{"FOOIDbarBaz", "Fooidbarbaz"},
{" A B C ", "ABC"},
{"foo bar baz", "FooBarBaz"},
{"foo \t \tbar baz \t", "FooBarBaz"},
Expand All @@ -364,7 +364,7 @@ func TestCamelCase(t *testing.T) {
{"foo--bar----baz", "FooBarBaz"},
{"foo__bar____baz", "FooBarBaz"},
{" Foo Bar Baz ", "FooBarBaz"},
{" Foo Bar_BazBlah ", "FooBarBazBlah"},
{" Foo Bar_BazBlah ", "FooBarBazblah"},
{" Foo.Bar.Baz", "FooBarBaz"},
{"#@!Foo@#$@$Bar>>>>>Baz", "FooBarBaz"},
}
Expand All @@ -385,20 +385,20 @@ func TestCamelCaseLower(t *testing.T) {
{"", ""},
{" ", ""},
{"foo", "foo"},
{"FOO", "fOO"},
{"FOO", "foo"},
{" \t foo \t", "foo"},
{"FooBarBaz", "fooBarBaz"},
{"FooBarBaz", "foobarbaz"},
{"Fo", "fo"},
{"fooID", "fooID"},
{"FoB", "foB"},
{"oFo", "oFo"},
{"FoBa", "foBa"},
{"oFoBa", "oFoBa"},
{"oFoB", "oFoB"},
{"Foo123B1234Baz1234", "foo123B1234Baz1234"},
{"fooID", "fooid"},
{"FoB", "fob"},
{"oFo", "ofo"},
{"FoBa", "foba"},
{"oFoBa", "ofoba"},
{"oFoB", "ofob"},
{"Foo123B1234Baz1234", "foo123b1234baz1234"},
{"Foo_Bar_Baz", "fooBarBaz"},
{"FooIDbarBaz", "fooIDbarBaz"},
{"FOOIDbarBaz", "fOOIDbarBaz"},
{"FooIDbarBaz", "fooidbarbaz"},
{"FOOIDbarBaz", "fooidbarbaz"},
{" A B C ", "aBC"},
{"foo bar baz", "fooBarBaz"},
{"foo \t \tbar baz \t", "fooBarBaz"},
Expand All @@ -408,7 +408,7 @@ func TestCamelCaseLower(t *testing.T) {
{"foo--bar----baz", "fooBarBaz"},
{"foo__bar____baz", "fooBarBaz"},
{" Foo Bar Baz ", "fooBarBaz"},
{" Foo Bar_BazBlah ", "fooBarBazBlah"},
{" Foo Bar_BazBlah ", "fooBarBazblah"},
{" Foo.Bar.Baz", "fooBarBaz"},
{"#@!Foo@#$@$Bar>>>>>Baz", "fooBarBaz"},
}
Expand Down