mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-07-21 22:54:24 +08:00
refs #75, more testing of windows path variants
This commit is contained in:
parent
3fd3482559
commit
b6dd2cd0f1
@ -2734,7 +2734,7 @@ TEST_CASE("Windows: Long filename support", "[filesystem][path][fs.path.win.long
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Windows: path namespace support", "[filesystem][path][fs.path.win.namespaces]")
|
TEST_CASE("Windows: path namespace handling", "[filesystem][path][fs.path.win.namespaces]")
|
||||||
{
|
{
|
||||||
#ifdef GHC_OS_WINDOWS
|
#ifdef GHC_OS_WINDOWS
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
@ -2745,22 +2745,41 @@ TEST_CASE("Windows: path namespace support", "[filesystem][path][fs.path.win.nam
|
|||||||
CHECK(!ec);
|
CHECK(!ec);
|
||||||
CHECK(p2 == p);
|
CHECK(p2 == p);
|
||||||
|
|
||||||
std::vector<fs::path> variants = {
|
struct TestInfo
|
||||||
R"(C:\Windows\notepad.exe)",
|
{
|
||||||
R"(\\.\C:\Windows\notepad.exe)",
|
std::string _path;
|
||||||
R"(\\?\C:\Windows\notepad.exe)",
|
std::string _string;
|
||||||
R"(\??\C:\Windows\notepad.exe)",
|
std::string _rootName;
|
||||||
R"(\\?\HarddiskVolume1\Windows\notepad.exe)",
|
std::string _rootPath;
|
||||||
R"(\\?\Harddisk0Partition1\Windows\notepad.exe)",
|
std::string _iterateResult;
|
||||||
R"(\\.\GLOBALROOT\Device\HarddiskVolume1\Windows\notepad.exe)",
|
|
||||||
R"(\\?\GLOBALROOT\Device\Harddisk0\Partition1\Windows\notepad.exe)",
|
|
||||||
R"(\\?\Volume{e8a4a89d-0000-0000-0000-100000000000}\Windows\notepad.exe)",
|
|
||||||
R"(\\LOCALHOST\C$\Windows\notepad.exe)",
|
|
||||||
R"(\\?\UNC\C$\Windows\notepad.exe)",
|
|
||||||
R"(\\?\GLOBALROOT\Device\Mup\C$\Windows\notepad.exe)",
|
|
||||||
};
|
};
|
||||||
for (auto pt : variants) {
|
std::vector<TestInfo> variants = {
|
||||||
std::cerr << pt.string() << " - " << pt.root_name() << ", " << pt.root_path() << ": " << iterateResult(pt) << std::endl;
|
{R"(C:\Windows\notepad.exe)", R"(C:\Windows\notepad.exe)", "C:", "C:\\", "C:,/,Windows,notepad.exe"},
|
||||||
|
#ifdef USE_STD_FS
|
||||||
|
{R"(\\?\C:\Windows\notepad.exe)", R"(\\?\C:\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,C:,Windows,notepad.exe"},
|
||||||
|
{R"(\??\C:\Windows\notepad.exe)", R"(\??\C:\Windows\notepad.exe)", "\\??", "\\??\\", "/??,/,C:,Windows,notepad.exe"},
|
||||||
|
#else
|
||||||
|
{R"(\\?\C:\Windows\notepad.exe)", R"(C:\Windows\notepad.exe)", "C:", "C:\\", "C:,/,Windows,notepad.exe"},
|
||||||
|
{R"(\??\C:\Windows\notepad.exe)", R"(C:\Windows\notepad.exe)", "C:", "C:\\", "C:,/,Windows,notepad.exe"},
|
||||||
|
#endif
|
||||||
|
{R"(\\.\C:\Windows\notepad.exe)", R"(\\.\C:\Windows\notepad.exe)", "\\\\.", "\\\\.\\", "//.,/,C:,Windows,notepad.exe"},
|
||||||
|
{R"(\\?\HarddiskVolume1\Windows\notepad.exe)", R"(\\?\HarddiskVolume1\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,HarddiskVolume1,Windows,notepad.exe"},
|
||||||
|
{R"(\\?\Harddisk0Partition1\Windows\notepad.exe)", R"(\\?\Harddisk0Partition1\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,Harddisk0Partition1,Windows,notepad.exe"},
|
||||||
|
{R"(\\.\GLOBALROOT\Device\HarddiskVolume1\Windows\notepad.exe)", R"(\\.\GLOBALROOT\Device\HarddiskVolume1\Windows\notepad.exe)", "\\\\.", "\\\\.\\", "//.,/,GLOBALROOT,Device,HarddiskVolume1,Windows,notepad.exe"},
|
||||||
|
{R"(\\?\GLOBALROOT\Device\Harddisk0\Partition1\Windows\notepad.exe)", R"(\\?\GLOBALROOT\Device\Harddisk0\Partition1\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,GLOBALROOT,Device,Harddisk0,Partition1,Windows,notepad.exe"},
|
||||||
|
{R"(\\?\Volume{e8a4a89d-0000-0000-0000-100000000000}\Windows\notepad.exe)", R"(\\?\Volume{e8a4a89d-0000-0000-0000-100000000000}\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,Volume{e8a4a89d-0000-0000-0000-100000000000},Windows,notepad.exe"},
|
||||||
|
{R"(\\LOCALHOST\C$\Windows\notepad.exe)", R"(\\LOCALHOST\C$\Windows\notepad.exe)", "\\\\LOCALHOST", "\\\\LOCALHOST\\", "//LOCALHOST,/,C$,Windows,notepad.exe"},
|
||||||
|
{R"(\\?\UNC\C$\Windows\notepad.exe)", R"(\\?\UNC\C$\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,UNC,C$,Windows,notepad.exe"},
|
||||||
|
{R"(\\?\GLOBALROOT\Device\Mup\C$\Windows\notepad.exe)", R"(\\?\GLOBALROOT\Device\Mup\C$\Windows\notepad.exe)", "\\\\?", "\\\\?\\", "//?,/,GLOBALROOT,Device,Mup,C$,Windows,notepad.exe"},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto ti : variants) {
|
||||||
|
INFO("Used path: " + ti._path);
|
||||||
|
auto p = fs::path(ti._path);
|
||||||
|
CHECK(p.string() == ti._string);
|
||||||
|
CHECK(p.root_name().string() == ti._rootName);
|
||||||
|
CHECK(p.root_path().string() == ti._rootPath);
|
||||||
|
CHECK(iterateResult(p) == ti._iterateResult);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
WARN("Windows specific tests are empty on non-Windows systems.");
|
WARN("Windows specific tests are empty on non-Windows systems.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user