go/tagengine/sanitize_test.go

31 lines
515 B
Go
Raw Normal View History

2024-11-11 05:36:55 +00:00
package tagengine
import "testing"
func TestSanitize(t *testing.T) {
sanitize := BasicSanitizer
type Case struct {
In string
Out string
}
cases := []Case{
{"", ""},
{"123abc", "123 abc"},
{"abc123", "abc 123"},
{"abc123xyz", "abc 123 xyz"},
{"1f2", "1 f 2"},
{" abc", "abc"},
{" ; KitKat/m&m's (bottle) @ ", "; kitkat / m & m ' s ( bottle ) @"},
{"€", "€"},
}
for _, tc := range cases {
out := sanitize(tc.In)
if out != tc.Out {
t.Fatalf("%v != %v", out, tc.Out)
}
}
}