fix : rename test testExpandUnix to testExpandVariableFromPath, add usecases for windows (#1850)

This commit is contained in:
Alexander B 2017-08-15 21:36:58 +03:00 committed by Aleksandar Fabijanic
parent e99e6126f4
commit b94ffc7211
2 changed files with 17 additions and 7 deletions

View File

@ -373,17 +373,27 @@ void PathTest::testParseUnix5()
assert (p.toString(Path::PATH_UNIX) == "/c:/windows/system32/");
}
void PathTest::testExpandUnix()
void PathTest::testExpandVariableFromPath()
{
#ifdef POCO_OS_FAMILY_WINDOWS
std::string pathWithoutVar = "\\usr\\share\\O1%%\\folder";
std::string pathWithVar = "%HOMEDRIVE%%HOMEPATH%\\folder";
std::string correctStringWithoutVar = "\\usr\\share\\O1%%\\folder";
#elif defined(POCO_OS_FAMILY_UNIX)
std::string pathWithoutVar = "/usr/share/O1\\$\\$/folder";
std::string pathWithVar = "${HOME}/folder";
Path p;
std::string correctStringWithoutVar = "/usr/share/O1$$/folder";
#else
return;
#endif
Poco::Path p;
std::string s = p.expand(pathWithoutVar);
assert (s == "/usr/share/O1$$/folder");
assert(s == correctStringWithoutVar);
s = p.expand(pathWithVar);
Path tmpPath = Path::home();
Poco::Path tmpPath = Poco::Path::home();
tmpPath.append("folder");
assert (s == tmpPath.toString());
assert(s == tmpPath.toString());
}
void PathTest::testParseWindows1()
@ -1653,7 +1663,7 @@ CppUnit::Test* PathTest::suite()
CppUnit_addTest(pSuite, PathTest, testParseUnix3);
CppUnit_addTest(pSuite, PathTest, testParseUnix4);
CppUnit_addTest(pSuite, PathTest, testParseUnix5);
CppUnit_addTest(pSuite, PathTest, testExpandUnix);
CppUnit_addTest(pSuite, PathTest, testExpandVariableFromPath);
CppUnit_addTest(pSuite, PathTest, testParseWindows1);
CppUnit_addTest(pSuite, PathTest, testParseWindows2);
CppUnit_addTest(pSuite, PathTest, testParseWindows3);

View File

@ -31,7 +31,7 @@ public:
void testParseUnix3();
void testParseUnix4();
void testParseUnix5();
void testExpandUnix();
void testExpandVariableFromPath();
void testParseWindows1();
void testParseWindows2();
void testParseWindows3();