remove POCO_WIN32_UTF8

This commit is contained in:
Günter Obiltschnig
2020-01-10 15:55:30 +01:00
parent c7c6871c4a
commit 7872c35324
5 changed files with 99 additions and 118 deletions

View File

@@ -17,16 +17,16 @@
#include "Poco/Environment.h"
#include <iostream>
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
#if defined(POCO_OS_FAMILY_WINDOWS)
#if defined(_WIN32_WCE)
#include "Poco/Path_WINCE.h"
#else
#include "Poco/Path_WIN32U.h"
#endif
#elif defined(POCO_OS_FAMILY_WINDOWS)
#include "Poco/Path_WIN32.h"
#endif
using Poco::Path;
using Poco::PathSyntaxException;
using Poco::Environment;
@@ -98,7 +98,7 @@ void PathTest::testParseUnix1()
assertTrue (!p.isDirectory());
assertTrue (p.isFile());
assertTrue (p.toString(Path::PATH_UNIX) == "usr");
p.parse("/usr/local", Path::PATH_UNIX);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -214,7 +214,7 @@ void PathTest::testParseUnix3()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/");
p.parse("/usr/local/./bin/", Path::PATH_UNIX);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -345,7 +345,7 @@ void PathTest::testParseUnix4()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_UNIX) == "../lib/");
p.parse("a/b/c/d", Path::PATH_UNIX);
assertTrue (p.isRelative());
assertTrue (!p.isAbsolute());
@@ -371,7 +371,7 @@ void PathTest::testParseUnix5()
assertTrue (p[1] == "system32");
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_UNIX) == "/c:/windows/system32/");
assertTrue (p.toString(Path::PATH_UNIX) == "/c:/windows/system32/");
}
@@ -467,7 +467,7 @@ void PathTest::testParseWindows2()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\");
p.parse("/usr/local", Path::PATH_WINDOWS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -574,7 +574,7 @@ void PathTest::testParseWindows2()
assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\");
}
void PathTest::testParseWindows3()
{
Path p;
@@ -739,7 +739,7 @@ void PathTest::testParseWindows4()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\");
p.parse("\\\\server\\files\\file", Path::PATH_WINDOWS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -770,7 +770,7 @@ void PathTest::testParseWindows4()
assertTrue (p.getNode() == "server");
assertTrue (!p.isDirectory());
assertTrue (p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\dir\\file");
assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\dir\\file");
p.parse("\\\\server", Path::PATH_WINDOWS);
assertTrue (!p.isRelative());
@@ -780,7 +780,7 @@ void PathTest::testParseWindows4()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\");
p.parse("c:\\", Path::PATH_WINDOWS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -788,7 +788,7 @@ void PathTest::testParseWindows4()
assertTrue (p.getDevice() == "c");
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\");
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\");
p.parse("c:\\WinNT", Path::PATH_WINDOWS);
assertTrue (!p.isRelative());
@@ -797,7 +797,7 @@ void PathTest::testParseWindows4()
assertTrue (p.getDevice() == "c");
assertTrue (!p.isDirectory());
assertTrue (p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT");
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT");
p.parse("c:\\WinNT\\", Path::PATH_WINDOWS);
assertTrue (!p.isRelative());
@@ -808,7 +808,7 @@ void PathTest::testParseWindows4()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT\\");
try
{
p.parse("~:\\", Path::PATH_WINDOWS);
@@ -817,7 +817,7 @@ void PathTest::testParseWindows4()
catch (PathSyntaxException&)
{
}
try
{
p.parse("c:file.txt", Path::PATH_WINDOWS);
@@ -826,7 +826,7 @@ void PathTest::testParseWindows4()
catch (PathSyntaxException&)
{
}
p.parse("a\\b\\c\\d", Path::PATH_WINDOWS);
assertTrue (p.isRelative());
assertTrue (!p.isAbsolute());
@@ -850,7 +850,7 @@ void PathTest::testParseVMS1()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "");
p.parse("[]", Path::PATH_VMS);
assertTrue (p.isRelative());
assertTrue (!p.isAbsolute());
@@ -858,7 +858,7 @@ void PathTest::testParseVMS1()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "");
p.parse("[foo]", Path::PATH_VMS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -896,7 +896,7 @@ void PathTest::testParseVMS1()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "[.foo.bar]");
p.parse("[foo.bar.foobar]", Path::PATH_VMS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -933,7 +933,7 @@ void PathTest::testParseVMS2()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar]");
p.parse("[foo.][bar]", Path::PATH_VMS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -943,7 +943,7 @@ void PathTest::testParseVMS2()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar]");
p.parse("[foo.bar][foo]", Path::PATH_VMS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -954,7 +954,7 @@ void PathTest::testParseVMS2()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar.foo]");
try
{
p.parse("[foo.bar][.foo]", Path::PATH_VMS);
@@ -972,7 +972,7 @@ void PathTest::testParseVMS2()
catch (PathSyntaxException&)
{
}
p.parse("[-]", Path::PATH_VMS);
assertTrue (p.isRelative());
assertTrue (!p.isAbsolute());
@@ -1192,7 +1192,7 @@ void PathTest::testParseVMS4()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "node::device:[foo.bar]");
p.parse("node::device:[foo.bar.][goo]", Path::PATH_VMS);
assertTrue (!p.isRelative());
assertTrue (p.isAbsolute());
@@ -1205,7 +1205,7 @@ void PathTest::testParseVMS4()
assertTrue (p.isDirectory());
assertTrue (!p.isFile());
assertTrue (p.toString(Path::PATH_VMS) == "node::device:[foo.bar.goo]");
p.parse("[]foo.txt", Path::PATH_VMS);
assertTrue (p.isRelative());
assertTrue (!p.isAbsolute());
@@ -1333,7 +1333,7 @@ void PathTest::testParseGuess()
assertTrue (p.getDevice() == "c");
assertTrue (!p.isDirectory());
assertTrue (p.isFile());
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT");
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT");
p.parse("foo:bar.txt;5", Path::PATH_GUESS);
assertTrue (!p.isRelative());
@@ -1382,12 +1382,12 @@ void PathTest::testStatics()
assertTrue (!s.empty());
Path p(s);
assertTrue (p.isDirectory() && p.isAbsolute());
s = Path::home();
assertTrue (!s.empty());
p = s;
assertTrue (p.isDirectory() && p.isAbsolute());
s = Path::temp();
assertTrue (!s.empty());
p = s;
@@ -1405,17 +1405,17 @@ void PathTest::testBaseNameExt()
assertTrue (p.getFileName() == "foo.bar");
assertTrue (p.getBaseName() == "foo");
assertTrue (p.getExtension() == "bar");
p.setBaseName("readme");
assertTrue (p.getFileName() == "readme.bar");
assertTrue (p.getBaseName() == "readme");
assertTrue (p.getExtension() == "bar");
p.setExtension("txt");
assertTrue (p.getFileName() == "readme.txt");
assertTrue (p.getBaseName() == "readme");
assertTrue (p.getExtension() == "txt");
p.setExtension("html");
assertTrue (p.getFileName() == "readme.html");
assertTrue (p.getBaseName() == "readme");
@@ -1434,7 +1434,7 @@ void PathTest::testAbsolute()
Path rel("Poco");
Path abs = rel.absolute(base);
assertTrue (abs.toString(Path::PATH_WINDOWS) == "C:\\Program Files\\Poco");
base.parse("/usr/local", Path::PATH_UNIX);
rel.parse("Poco/include", Path::PATH_UNIX);
abs = rel.absolute(base);
@@ -1516,7 +1516,7 @@ void PathTest::testExpand()
#if defined(POCO_OS_FAMILY_UNIX)
std::string s = Path::expand("~/.bashrc");
assertTrue (s == Path::expand("$HOME/.bashrc"));
assertTrue (s == Environment::get("HOME") + "/.bashrc" ||
assertTrue (s == Environment::get("HOME") + "/.bashrc" ||
s == Environment::get("HOME") + "//.bashrc");
Path p(s);
s = Path::expand("$HOME/.bashrc");
@@ -1565,7 +1565,7 @@ void PathTest::testFind()
#endif
assertTrue (found);
assertTrue (!notfound);
std::string fn = p.toString();
assertTrue (fn.size() > 0);
}
@@ -1586,15 +1586,15 @@ void PathTest::testResolve()
Path p("c:\\foo\\", Path::PATH_WINDOWS);
p.resolve("test.dat");
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\test.dat");
p.assign("c:\\foo\\", Path::PATH_WINDOWS);
p.resolve(Path("d:\\bar.txt", Path::PATH_WINDOWS));
assertTrue (p.toString(Path::PATH_WINDOWS) == "d:\\bar.txt");
p.assign("c:\\foo\\bar.txt", Path::PATH_WINDOWS);
p.resolve("foo.txt");
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\foo.txt");
p.assign("c:\\foo\\bar\\", Path::PATH_WINDOWS);
p.resolve(Path("..\\baz\\test.dat", Path::PATH_WINDOWS));
assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\baz\\test.dat");