This commit is contained in:
2025-04-23 04:18:28 +02:00
parent 10a7d9bb6b
commit a16ac8f627
276 changed files with 85166 additions and 1 deletions

View 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)
}
}
}