You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
617 B
Go
41 lines
617 B
Go
5 years ago
|
package blammo
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestPath(t *testing.T) {
|
||
|
p := NewPath("alice")
|
||
|
if p.String() != "alice" {
|
||
|
t.Error("bad root path generation")
|
||
|
}
|
||
|
|
||
|
p = p.Child("bob")
|
||
|
if p.String() != "alice/bob" {
|
||
|
t.Error("bad child path generation")
|
||
|
}
|
||
|
|
||
|
p = p.Child("carol")
|
||
|
if p.String() != "alice/bob/carol" {
|
||
|
t.Error("bad grandchild generation")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestSafeNames(t *testing.T) {
|
||
|
safeNames := []string{
|
||
|
"one",
|
||
|
"1",
|
||
|
"1one",
|
||
|
"niño",
|
||
|
"garçon",
|
||
|
"你好",
|
||
|
"",
|
||
|
}
|
||
|
|
||
|
for _, n := range safeNames {
|
||
|
if !IsSafeName(n) {
|
||
|
t.Errorf("expected safe name is considered unsafe: %s", n)
|
||
|
}
|
||
|
}
|
||
|
}
|