summaryrefslogtreecommitdiffstats
path: root/helpers/path_test.go
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2014-11-09 22:40:15 +0100
committerspf13 <steve.francia@gmail.com>2014-11-13 22:47:06 -0500
commit91e03b9fbc8cf236d111607c2120f130ea07c772 (patch)
treeb86db716352cca3d1b226ae5ea1e89914bf2d314 /helpers/path_test.go
parent6bf6a810ee7a19c64a14d0ea7d5d349b81bc913e (diff)
Reinsert deleted test
This test was deleted by mistake in owenwaller's contribution to add more tests. I haven't looked closer, there may be more missing.
Diffstat (limited to 'helpers/path_test.go')
-rw-r--r--helpers/path_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/helpers/path_test.go b/helpers/path_test.go
index 4a10bd9d4..a7cca35bb 100644
--- a/helpers/path_test.go
+++ b/helpers/path_test.go
@@ -55,6 +55,29 @@ func TestMakePathToLower(t *testing.T) {
}
}
+func TestMakePathRelative(t *testing.T) {
+ type test struct {
+ inPath, path1, path2, output string
+ }
+
+ data := []test{
+ {"/abc/bcd/ab.css", "/abc/bcd", "/bbc/bcd", "/ab.css"},
+ {"/abc/bcd/ab.css", "/abcd/bcd", "/abc/bcd", "/ab.css"},
+ }
+
+ for i, d := range data {
+ output, _ := MakePathRelative(d.inPath, d.path1, d.path2)
+ if d.output != output {
+ t.Errorf("Test #%d failed. Expected %q got %q", i, d.output, output)
+ }
+ }
+ _, error := MakePathRelative("a/b/c.ss", "/a/c", "/d/c", "/e/f")
+
+ if error == nil {
+ t.Errorf("Test #%d failed. Expected error")
+ }
+}
+
func TestMakeTitle(t *testing.T) {
type test struct {
input, expected string