@@ -30,6 +30,8 @@ class TestPath : public TestFixture {
3030 void run () {
3131 TEST_CASE (simplify_path);
3232 TEST_CASE (accept_file);
33+ TEST_CASE (getCurrentPath);
34+ TEST_CASE (isAbsolute);
3335 TEST_CASE (getRelative);
3436 TEST_CASE (is_c);
3537 TEST_CASE (is_cpp);
@@ -110,6 +112,28 @@ class TestPath : public TestFixture {
110112 ASSERT_EQUALS (false , Path::acceptFile (" index.hpp" ));
111113 }
112114
115+ void getCurrentPath () const {
116+ ASSERT_EQUALS (true , Path::isAbsolute (Path::getCurrentPath ()));
117+ }
118+
119+ void isAbsolute () const {
120+ #ifdef _WIN32
121+ ASSERT_EQUALS (true , Path::isAbsolute (" C:\\ foo\\ bar" ));
122+ ASSERT_EQUALS (true , Path::isAbsolute (" C:/foo/bar" ));
123+ ASSERT_EQUALS (true , Path::isAbsolute (" \\\\ foo\\ bar" ));
124+ ASSERT_EQUALS (false , Path::isAbsolute (" foo\\ bar" ));
125+ ASSERT_EQUALS (false , Path::isAbsolute (" foo/bar" ));
126+ ASSERT_EQUALS (false , Path::isAbsolute (" foo.cpp" ));
127+ ASSERT_EQUALS (false , Path::isAbsolute (" C:foo.cpp" ));
128+ ASSERT_EQUALS (false , Path::isAbsolute (" C:foo\\ bar.cpp" ));
129+ #else
130+ ASSERT_EQUALS (true , Path::isAbsolute (" /foo/bar" ));
131+ ASSERT_EQUALS (true , Path::isAbsolute (" /" ));
132+ ASSERT_EQUALS (false , Path::isAbsolute (" foo/bar" ));
133+ ASSERT_EQUALS (false , Path::isAbsolute (" foo.cpp" ));
134+ #endif
135+ }
136+
113137 void getRelative () const {
114138 std::vector<std::string> basePaths;
115139 basePaths.push_back (" " ); // Don't crash with empty paths
0 commit comments