From: bep Date: Sun, 9 Nov 2014 21:40:15 +0000 (+0100) Subject: Reinsert deleted test X-Git-Tag: v0.13~303 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=91e03b9fbc8cf236d111607c2120f130ea07c772;p=brevno-suite%2Fhugo 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. --- diff --git a/helpers/path_test.go b/helpers/path_test.go index 4a10bd9d..a7cca35b 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