gowebdav/utils_test.go

19 lines
397 B
Go
Raw Normal View History

2014-10-23 11:15:28 +02:00
package gowebdav
import "testing"
func TestJoin(t *testing.T) {
eq(t, "/", "", "")
eq(t, "/", "/", "/")
eq(t, "/foo", "", "/foo")
eq(t, "foo/foo", "foo/", "/foo")
eq(t, "foo/foo", "foo/", "foo")
}
func eq(t *testing.T, expected string, s0 string, s1 string) {
s := Join(s0, s1)
if s != expected {
2014-10-23 11:28:46 +02:00
t.Error("For", "'"+s0+"','"+s1+"'", "expeted", "'"+expected+"'", "got", "'"+s+"'")
2014-10-23 11:15:28 +02:00
}
}