From 7b51537be2341b62795c308c140faca387fa04e6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 16 Aug 2010 16:01:31 +0000 Subject: Common: Fix bug in lastPathComponent. Prior to this change lastPathComponent would not create a correct result, when the input of lastPathComponent did not contain a single separator. I also added a test case for this in our unit tests. svn-id: r52123 --- test/common/str.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/common/str.h b/test/common/str.h index 6581c37cdb..e1f2b39578 100644 --- a/test/common/str.h +++ b/test/common/str.h @@ -266,6 +266,8 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(Common::lastPathComponent("foo/./bar", '/'), "bar"); TS_ASSERT_EQUALS(Common::lastPathComponent("foo//./bar//", '/'), "bar"); TS_ASSERT_EQUALS(Common::lastPathComponent("foo//.bar//", '/'), ".bar"); + + TS_ASSERT_EQUALS(Common::lastPathComponent("foo", '/'), "foo"); } void test_normalizePath() { -- cgit v1.2.3