From dea8e63df27a6311b9b8b5b0b23482c3971683db Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 24 Oct 2019 10:32:02 -0400 Subject: [PATCH] util: Add more tests to HasPathPrefix We need to ensure this behaviour in a future commit, so might as well double check that this works as expected! --- util/util_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/util/util_test.go b/util/util_test.go index 66d53775..c1efced8 100644 --- a/util/util_test.go +++ b/util/util_test.go @@ -152,6 +152,27 @@ func TestUtilT3(t *testing.T) { if HasPathPrefix("/foo/bar/baz/boo/", "/foo/") != true { t.Errorf("result should be true.") } + + if HasPathPrefix("/foo/bar/baz", "/foo/bar/baz") != true { + t.Errorf("result should be true.") + } + + if HasPathPrefix("/foo/bar/baz/", "/foo/bar/baz/") != true { + t.Errorf("result should be true.") + } + + if HasPathPrefix("/foo", "/foo") != true { + t.Errorf("result should be true.") + } + + if HasPathPrefix("/foo/", "/foo/") != true { + t.Errorf("result should be true.") + } + + if HasPathPrefix("/", "/") != true { + t.Errorf("result should be true.") + } + } func TestUtilT4(t *testing.T) {