From 5963cf2afc61ff128bda69f2fb457f5e085eedd8 Mon Sep 17 00:00:00 2001 From: Ace-Tang Date: Fri, 14 Sep 2018 21:35:39 +0800 Subject: [PATCH] test: add more test case for CleanPath Signed-off-by: Ace-Tang --- libcontainer/utils/utils_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libcontainer/utils/utils_test.go b/libcontainer/utils/utils_test.go index 627777a14..395eedcf6 100644 --- a/libcontainer/utils/utils_test.go +++ b/libcontainer/utils/utils_test.go @@ -129,4 +129,14 @@ func TestCleanPath(t *testing.T) { if path != "/var" { t.Errorf("expected to receive '/var' and received %s", path) } + + path = CleanPath("/foo/bar/") + if path != "/foo/bar" { + t.Errorf("expected to receive '/foo/bar' and received %s", path) + } + + path = CleanPath("/foo/bar/../") + if path != "/foo" { + t.Errorf("expected to receive '/foo' and received %s", path) + } }