added basic tests

This commit is contained in:
Hazel Noack
2025-10-07 14:03:12 +02:00
parent b65d68ed86
commit 4f527f3747
3 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package common
import "testing"
func TestUnify(t *testing.T) {
if "foo" != Unify("foo") {
t.Errorf(`"foo" has to be untouched by unify`)
}
if "foo" != Unify("Foo") {
t.Errorf(`"Foo" needs to be lowercase after test`)
}
if "foo" != Unify(" Foo") {
t.Errorf(`The spaces need to be stripped`)
}
if "foo" != Unify(" Foo ") {
t.Errorf(`The spaces need to be stripped`)
}
if "foo bar" != Unify("Foo bar") {
t.Errorf(`Single whitespaces need to be left alone`)
}
if "foo bar" != Unify("Foo bar") {
t.Errorf(`Double whitespaces need to be removed`)
}
if "foo bar" != Unify("Foo bar") {
t.Errorf(`Double whitespaces need to be removed`)
}
if "foo bar baz" != Unify("Foo bar baz") {
t.Errorf(`Double whitespaces need to be removed`)
}
}