31 lines
515 B
Go
31 lines
515 B
Go
|
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)
|
||
|
}
|
||
|
}
|
||
|
}
|