...
This commit is contained in:
32
pkg/tools/name_fix_test.go
Normal file
32
pkg/tools/name_fix_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package tools
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNameFix(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{"Hello World", "hello_world"},
|
||||
{"Hello_World", "hello_world"},
|
||||
{"Hello__World", "hello_world"},
|
||||
{"Hello-World", "hello_world"},
|
||||
{"Hello,World", "hello_world"},
|
||||
{"Hello,World.MD", "hello_world.md"},
|
||||
{"Hello,World.MD", "hello_world.md"},
|
||||
{"UPPER case", "upper_case"},
|
||||
{"Mixed-Case,String", "mixed_case_string"},
|
||||
{"Non-ASCII: éñçödéd", "non_ascii_dd"},
|
||||
{"Multiple spaces", "multiple_spaces"},
|
||||
{"Symbols: !@#$%^&*()", "symbols_"},
|
||||
{"Getting- Started", "getting_started"},
|
||||
{"Getting- ,Started", "getting_,started"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
result := NameFix(test.input)
|
||||
if result != test.expected {
|
||||
t.Errorf("NameFix(%q) = %q, expected %q", test.input, result, test.expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user