diff options
author | Max Horn | 2011-06-03 17:33:07 +0200 |
---|---|---|
committer | Max Horn | 2011-06-03 17:33:07 +0200 |
commit | 0a0258edcfe7622115ab7f5418f318f6c0f1c866 (patch) | |
tree | 033c0f0d1f179475d0a1ba20fb4efff904721b09 /test/common | |
parent | 3cc2e5b9278e5f1ac846ff2a62c55361a69a8867 (diff) | |
download | scummvm-rg350-0a0258edcfe7622115ab7f5418f318f6c0f1c866.tar.gz scummvm-rg350-0a0258edcfe7622115ab7f5418f318f6c0f1c866.tar.bz2 scummvm-rg350-0a0258edcfe7622115ab7f5418f318f6c0f1c866.zip |
COMMON: Let Common::normalizePath normalize '..' in paths
There are some unit tests to verify that this works correctly.
There is a small chance that this causes regressions in weird setups.
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/str.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h index 0dee16a493..2c563f3132 100644 --- a/test/common/str.h +++ b/test/common/str.h @@ -284,6 +284,19 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(Common::normalizePath("foo/./bar", '/'), "foo/bar"); TS_ASSERT_EQUALS(Common::normalizePath("foo//./bar//", '/'), "foo/bar"); TS_ASSERT_EQUALS(Common::normalizePath("foo//.bar//", '/'), "foo/.bar"); + + TS_ASSERT_EQUALS(Common::normalizePath("..", '/'), ".."); + TS_ASSERT_EQUALS(Common::normalizePath("../", '/'), ".."); + TS_ASSERT_EQUALS(Common::normalizePath("/..", '/'), "/.."); + TS_ASSERT_EQUALS(Common::normalizePath("../bar", '/'), "../bar"); + TS_ASSERT_EQUALS(Common::normalizePath("foo//../", '/'), ""); + TS_ASSERT_EQUALS(Common::normalizePath("foo/../bar", '/'), "bar"); + TS_ASSERT_EQUALS(Common::normalizePath("foo//../bar//", '/'), "bar"); + TS_ASSERT_EQUALS(Common::normalizePath("foo//..bar//", '/'), "foo/..bar"); + + TS_ASSERT_EQUALS(Common::normalizePath("foo/../../bar//", '/'), "../bar"); + TS_ASSERT_EQUALS(Common::normalizePath("../foo/../bar", '/'), "../bar"); + TS_ASSERT_EQUALS(Common::normalizePath("../../foo/bar/", '/'), "../../foo/bar"); } void test_matchString() { |