feat!: redefine hostname as a required property that maps to --host (#256)

This commit is contained in:
Gareth
2024-05-05 12:42:30 -07:00
parent 29620f2897
commit fa851967b1
21 changed files with 388 additions and 302 deletions
@@ -0,0 +1,46 @@
package stringutil
import "testing"
func TestSanitizeID(t *testing.T) {
tcs := []struct {
name string
id string
want string
}{
{
name: "empty",
id: "",
want: "",
},
{
name: "no change",
id: "abc123",
want: "abc123",
},
{
name: "spaces",
id: "a b c 1 2 3",
want: "a_b_c_1_2_3",
},
{
name: "special characters",
id: "a!b@c#1$2%3",
want: "a_b_c_1_2_3",
},
{
name: "unicode",
id: "a👍b👍c👍1👍2👍3",
want: "a_b_c_1_2_3",
},
}
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
got := SanitizeID(tc.id)
if got != tc.want {
t.Errorf("SanitizeID(%q) = %q, want %q", tc.id, got, tc.want)
}
})
}
}