Skip to content

Commit

Permalink
bake: add utils test
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGamba committed Jun 22, 2024
1 parent de229a1 commit 2b2d7ec
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions bake/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package main

import "testing"

func TestCamelToKebab(t *testing.T) {
tests := []struct {
name string
in string
out string
}{
{
name: "single",
in: "A",
out: "a",
},
{
name: "lower",
in: "abc",
out: "abc",
},
{
name: "upper",
in: "ABC",
out: "abc",
},
{
name: "mixed",
in: "aBC",
out: "a-bc",
},
{
name: "mixed2",
in: "AbC",
out: "ab-c",
},
{
name: "mixed10",
in: "AbCdEfGhIjK",
out: "ab-cd-ef-gh-ij-k",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := camelToKebab(tt.in); got != tt.out {
t.Errorf("got %v, want %v", got, tt.out)
}
})
}
}

0 comments on commit 2b2d7ec

Please sign in to comment.