From 2b2d7ecb246fe357b0a37e870fc0ef6e225698cb Mon Sep 17 00:00:00 2001 From: David Gamba Date: Fri, 21 Jun 2024 21:27:58 -0600 Subject: [PATCH] bake: add utils test --- bake/utils_test.go | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 bake/utils_test.go diff --git a/bake/utils_test.go b/bake/utils_test.go new file mode 100644 index 0000000..d6a22e5 --- /dev/null +++ b/bake/utils_test.go @@ -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) + } + }) + } +}