| 280 | } |
| 281 | |
| 282 | void pathiterator() const { |
| 283 | /* See https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats |
| 284 | * for information on Windows path syntax. */ |
| 285 | using PathIterator = PathMatchTest::PathIterator; |
| 286 | ASSERT_EQUALS("/", PathIterator("/", nullptr, unix).read()); |
| 287 | ASSERT_EQUALS("/", PathIterator("//", nullptr, unix).read()); |
| 288 | ASSERT_EQUALS("/", PathIterator("/", "/", unix).read()); |
| 289 | ASSERT_EQUALS("/hello/world", PathIterator("/hello/universe/.", "../world//", unix).read()); |
| 290 | ASSERT_EQUALS("/", PathIterator("//./..//.///.", "../../..///", unix).read()); |
| 291 | ASSERT_EQUALS("/foo/bar", PathIterator(nullptr, "/foo/bar/.", unix).read()); |
| 292 | ASSERT_EQUALS("/foo/bar", PathIterator("/foo/bar/.", nullptr, unix).read()); |
| 293 | ASSERT_EQUALS("/foo/bar", PathIterator("/foo", "bar", unix).read()); |
| 294 | ASSERT_EQUALS("", PathIterator("", "", unix).read()); |
| 295 | ASSERT_EQUALS("", PathIterator("", nullptr, unix).read()); |
| 296 | ASSERT_EQUALS("", PathIterator(nullptr, "", unix).read()); |
| 297 | ASSERT_EQUALS("", PathIterator(nullptr, nullptr, unix).read()); |
| 298 | ASSERT_EQUALS("c:", PathIterator("C:", nullptr, windows).read()); |
| 299 | /* C: without slash is a bit ambiguous. It should probably not be considered a root because it's |
| 300 | * not fully qualified (it designates the current directory on the C drive), |
| 301 | * so this test could be considered to be unspecified behavior. */ |
| 302 | ASSERT_EQUALS("c:", PathIterator("C:", "../..", windows).read()); |
| 303 | ASSERT_EQUALS("c:/windows/system32", PathIterator("C:", "Windows\\System32\\Drivers\\..\\.", windows).read()); |
| 304 | ASSERT_EQUALS("c:/", PathIterator("C:\\Program Files\\", "..", windows).read()); |
| 305 | ASSERT_EQUALS("//./", PathIterator("\\\\.\\C:\\", "../..", windows).read()); |
| 306 | ASSERT_EQUALS("//./", PathIterator("\\\\.\\", "..\\..", windows).read()); |
| 307 | ASSERT_EQUALS("//?/", PathIterator("\\\\?\\", "..\\..", windows).read()); |
| 308 | /* The server and share should actually be considered part of the root and not be removed */ |
| 309 | ASSERT_EQUALS("//", PathIterator("\\\\Server\\Share\\Directory", "../..\\../..", windows).read()); |
| 310 | } |
| 311 | }; |
| 312 | |
| 313 | REGISTER_TEST(TestPathMatch) |
nothing calls this directly
no test coverage detected