]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/filesystem/test/path_test.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / filesystem / test / path_test.cpp
index c6f0b11b35fbb5d73e1f0198316ac3dbb0b9f4a5..99a5ee707f4e6a99cbd173103bbf6f1cdbe6486d 100644 (file)
@@ -772,6 +772,9 @@ namespace
     BOOST_TEST(path("..").filename() == "..");
 
     // stem() tests not otherwise covered
+    BOOST_TEST(path(".").stem() == ".");
+    BOOST_TEST(path("..").stem() == "..");
+    BOOST_TEST(path(".a").stem() == "");
     BOOST_TEST(path("b").stem() == "b");
     BOOST_TEST(path("a/b.txt").stem() == "b");
     BOOST_TEST(path("a/b.").stem() == "b"); 
@@ -779,6 +782,9 @@ namespace
     BOOST_TEST(path("a.b.c.").stem() == "a.b.c");
 
     // extension() tests not otherwise covered
+    BOOST_TEST(path(".").extension() == "");
+    BOOST_TEST(path("..").extension() == "");
+    BOOST_TEST(path(".a").extension() == ".a");
     BOOST_TEST(path("a/b").extension() == "");
     BOOST_TEST(path("a.b/c").extension() == "");
     BOOST_TEST(path("a/b.txt").extension() == ".txt");
@@ -1819,94 +1825,94 @@ namespace
     //  and the expected results are also given in generic form. Otherwise many of the
     //  tests would incorrectly be reported as failing on Windows.
 
-    PATH_TEST_EQ(path("").lexically_normal().generic(), "");
-    PATH_TEST_EQ(path("/").lexically_normal().generic(), "/");
-    PATH_TEST_EQ(path("//").lexically_normal().generic(), "//");
-    PATH_TEST_EQ(path("///").lexically_normal().generic(), "/");
-    PATH_TEST_EQ(path("f").lexically_normal().generic(), "f");
-    PATH_TEST_EQ(path("foo").lexically_normal().generic(), "foo");
-    PATH_TEST_EQ(path("foo/").lexically_normal().generic(), "foo/.");
-    PATH_TEST_EQ(path("f/").lexically_normal().generic(), "f/.");
-    PATH_TEST_EQ(path("/foo").lexically_normal().generic(), "/foo");
-    PATH_TEST_EQ(path("foo/bar").lexically_normal().generic(), "foo/bar");
-    PATH_TEST_EQ(path("..").lexically_normal().generic(), "..");
-    PATH_TEST_EQ(path("../..").lexically_normal().generic(), "../..");
-    PATH_TEST_EQ(path("/..").lexically_normal().generic(), "/..");
-    PATH_TEST_EQ(path("/../..").lexically_normal().generic(), "/../..");
-    PATH_TEST_EQ(path("../foo").lexically_normal().generic(), "../foo");
-    PATH_TEST_EQ(path("foo/..").lexically_normal().generic(), ".");
-    PATH_TEST_EQ(path("foo/../").lexically_normal().generic(), "./.");
-    PATH_TEST_EQ((path("foo") / "..").lexically_normal().generic() , ".");
-    PATH_TEST_EQ(path("foo/...").lexically_normal().generic(), "foo/...");
-    PATH_TEST_EQ(path("foo/.../").lexically_normal().generic(), "foo/.../.");
-    PATH_TEST_EQ(path("foo/..bar").lexically_normal().generic(), "foo/..bar");
-    PATH_TEST_EQ(path("../f").lexically_normal().generic(), "../f");
-    PATH_TEST_EQ(path("/../f").lexically_normal().generic(), "/../f");
-    PATH_TEST_EQ(path("f/..").lexically_normal().generic(), ".");
-    PATH_TEST_EQ((path("f") / "..").lexically_normal().generic() , ".");
-    PATH_TEST_EQ(path("foo/../..").lexically_normal().generic(), "..");
-    PATH_TEST_EQ(path("foo/../../").lexically_normal().generic(), "../.");
-    PATH_TEST_EQ(path("foo/../../..").lexically_normal().generic(), "../..");
-    PATH_TEST_EQ(path("foo/../../../").lexically_normal().generic(), "../../.");
-    PATH_TEST_EQ(path("foo/../bar").lexically_normal().generic(), "bar");
-    PATH_TEST_EQ(path("foo/../bar/").lexically_normal().generic(), "bar/.");
-    PATH_TEST_EQ(path("foo/bar/..").lexically_normal().generic(), "foo");
-    PATH_TEST_EQ(path("foo/./bar/..").lexically_normal().generic(), "foo");
+    PATH_TEST_EQ(path("").lexically_normal().generic_path(), "");
+    PATH_TEST_EQ(path("/").lexically_normal().generic_path(), "/");
+    PATH_TEST_EQ(path("//").lexically_normal().generic_path(), "//");
+    PATH_TEST_EQ(path("///").lexically_normal().generic_path(), "/");
+    PATH_TEST_EQ(path("f").lexically_normal().generic_path(), "f");
+    PATH_TEST_EQ(path("foo").lexically_normal().generic_path(), "foo");
+    PATH_TEST_EQ(path("foo/").lexically_normal().generic_path(), "foo/.");
+    PATH_TEST_EQ(path("f/").lexically_normal().generic_path(), "f/.");
+    PATH_TEST_EQ(path("/foo").lexically_normal().generic_path(), "/foo");
+    PATH_TEST_EQ(path("foo/bar").lexically_normal().generic_path(), "foo/bar");
+    PATH_TEST_EQ(path("..").lexically_normal().generic_path(), "..");
+    PATH_TEST_EQ(path("../..").lexically_normal().generic_path(), "../..");
+    PATH_TEST_EQ(path("/..").lexically_normal().generic_path(), "/..");
+    PATH_TEST_EQ(path("/../..").lexically_normal().generic_path(), "/../..");
+    PATH_TEST_EQ(path("../foo").lexically_normal().generic_path(), "../foo");
+    PATH_TEST_EQ(path("foo/..").lexically_normal().generic_path(), ".");
+    PATH_TEST_EQ(path("foo/../").lexically_normal().generic_path(), "./.");
+    PATH_TEST_EQ((path("foo") / "..").lexically_normal().generic_path() , ".");
+    PATH_TEST_EQ(path("foo/...").lexically_normal().generic_path(), "foo/...");
+    PATH_TEST_EQ(path("foo/.../").lexically_normal().generic_path(), "foo/.../.");
+    PATH_TEST_EQ(path("foo/..bar").lexically_normal().generic_path(), "foo/..bar");
+    PATH_TEST_EQ(path("../f").lexically_normal().generic_path(), "../f");
+    PATH_TEST_EQ(path("/../f").lexically_normal().generic_path(), "/../f");
+    PATH_TEST_EQ(path("f/..").lexically_normal().generic_path(), ".");
+    PATH_TEST_EQ((path("f") / "..").lexically_normal().generic_path() , ".");
+    PATH_TEST_EQ(path("foo/../..").lexically_normal().generic_path(), "..");
+    PATH_TEST_EQ(path("foo/../../").lexically_normal().generic_path(), "../.");
+    PATH_TEST_EQ(path("foo/../../..").lexically_normal().generic_path(), "../..");
+    PATH_TEST_EQ(path("foo/../../../").lexically_normal().generic_path(), "../../.");
+    PATH_TEST_EQ(path("foo/../bar").lexically_normal().generic_path(), "bar");
+    PATH_TEST_EQ(path("foo/../bar/").lexically_normal().generic_path(), "bar/.");
+    PATH_TEST_EQ(path("foo/bar/..").lexically_normal().generic_path(), "foo");
+    PATH_TEST_EQ(path("foo/./bar/..").lexically_normal().generic_path(), "foo");
     std::cout << path("foo/./bar/..").lexically_normal() << std::endl;  // outputs "foo"
-    PATH_TEST_EQ(path("foo/bar/../").lexically_normal().generic(), "foo/.");
-    PATH_TEST_EQ(path("foo/./bar/../").lexically_normal().generic(), "foo/.");
+    PATH_TEST_EQ(path("foo/bar/../").lexically_normal().generic_path(), "foo/.");
+    PATH_TEST_EQ(path("foo/./bar/../").lexically_normal().generic_path(), "foo/.");
     std::cout << path("foo/./bar/../").lexically_normal() << std::endl;  // POSIX: "foo/.", Windows: "foo\." 
-    PATH_TEST_EQ(path("foo/bar/../..").lexically_normal().generic(), ".");
-    PATH_TEST_EQ(path("foo/bar/../../").lexically_normal().generic(), "./.");
-    PATH_TEST_EQ(path("foo/bar/../blah").lexically_normal().generic(), "foo/blah");
-    PATH_TEST_EQ(path("f/../b").lexically_normal().generic(), "b");
-    PATH_TEST_EQ(path("f/b/..").lexically_normal().generic(), "f");
-    PATH_TEST_EQ(path("f/b/../").lexically_normal().generic(), "f/.");
-    PATH_TEST_EQ(path("f/b/../a").lexically_normal().generic(), "f/a");
-    PATH_TEST_EQ(path("foo/bar/blah/../..").lexically_normal().generic(), "foo");
-    PATH_TEST_EQ(path("foo/bar/blah/../../bletch").lexically_normal().generic(), "foo/bletch");
-    PATH_TEST_EQ(path("//net").lexically_normal().generic(), "//net");
-    PATH_TEST_EQ(path("//net/").lexically_normal().generic(), "//net/");
-    PATH_TEST_EQ(path("//..net").lexically_normal().generic(), "//..net");
-    PATH_TEST_EQ(path("//net/..").lexically_normal().generic(), "//net/..");
-    PATH_TEST_EQ(path("//net/foo").lexically_normal().generic(), "//net/foo");
-    PATH_TEST_EQ(path("//net/foo/").lexically_normal().generic(), "//net/foo/.");
-    PATH_TEST_EQ(path("//net/foo/..").lexically_normal().generic(), "//net/");
-    PATH_TEST_EQ(path("//net/foo/../").lexically_normal().generic(), "//net/.");
-
-    PATH_TEST_EQ(path("/net/foo/bar").lexically_normal().generic(), "/net/foo/bar");
-    PATH_TEST_EQ(path("/net/foo/bar/").lexically_normal().generic(), "/net/foo/bar/.");
-    PATH_TEST_EQ(path("/net/foo/..").lexically_normal().generic(), "/net");
-    PATH_TEST_EQ(path("/net/foo/../").lexically_normal().generic(), "/net/.");
-
-    PATH_TEST_EQ(path("//net//foo//bar").lexically_normal().generic(), "//net/foo/bar");
-    PATH_TEST_EQ(path("//net//foo//bar//").lexically_normal().generic(), "//net/foo/bar/.");
-    PATH_TEST_EQ(path("//net//foo//..").lexically_normal().generic(), "//net/");
-    PATH_TEST_EQ(path("//net//foo//..//").lexically_normal().generic(), "//net/.");
-
-    PATH_TEST_EQ(path("///net///foo///bar").lexically_normal().generic(), "/net/foo/bar");
-    PATH_TEST_EQ(path("///net///foo///bar///").lexically_normal().generic(), "/net/foo/bar/.");
-    PATH_TEST_EQ(path("///net///foo///..").lexically_normal().generic(), "/net");
-    PATH_TEST_EQ(path("///net///foo///..///").lexically_normal().generic(), "/net/.");
+    PATH_TEST_EQ(path("foo/bar/../..").lexically_normal().generic_path(), ".");
+    PATH_TEST_EQ(path("foo/bar/../../").lexically_normal().generic_path(), "./.");
+    PATH_TEST_EQ(path("foo/bar/../blah").lexically_normal().generic_path(), "foo/blah");
+    PATH_TEST_EQ(path("f/../b").lexically_normal().generic_path(), "b");
+    PATH_TEST_EQ(path("f/b/..").lexically_normal().generic_path(), "f");
+    PATH_TEST_EQ(path("f/b/../").lexically_normal().generic_path(), "f/.");
+    PATH_TEST_EQ(path("f/b/../a").lexically_normal().generic_path(), "f/a");
+    PATH_TEST_EQ(path("foo/bar/blah/../..").lexically_normal().generic_path(), "foo");
+    PATH_TEST_EQ(path("foo/bar/blah/../../bletch").lexically_normal().generic_path(), "foo/bletch");
+    PATH_TEST_EQ(path("//net").lexically_normal().generic_path(), "//net");
+    PATH_TEST_EQ(path("//net/").lexically_normal().generic_path(), "//net/");
+    PATH_TEST_EQ(path("//..net").lexically_normal().generic_path(), "//..net");
+    PATH_TEST_EQ(path("//net/..").lexically_normal().generic_path(), "//net/..");
+    PATH_TEST_EQ(path("//net/foo").lexically_normal().generic_path(), "//net/foo");
+    PATH_TEST_EQ(path("//net/foo/").lexically_normal().generic_path(), "//net/foo/.");
+    PATH_TEST_EQ(path("//net/foo/..").lexically_normal().generic_path(), "//net/");
+    PATH_TEST_EQ(path("//net/foo/../").lexically_normal().generic_path(), "//net/.");
+
+    PATH_TEST_EQ(path("/net/foo/bar").lexically_normal().generic_path(), "/net/foo/bar");
+    PATH_TEST_EQ(path("/net/foo/bar/").lexically_normal().generic_path(), "/net/foo/bar/.");
+    PATH_TEST_EQ(path("/net/foo/..").lexically_normal().generic_path(), "/net");
+    PATH_TEST_EQ(path("/net/foo/../").lexically_normal().generic_path(), "/net/.");
+
+    PATH_TEST_EQ(path("//net//foo//bar").lexically_normal().generic_path(), "//net/foo/bar");
+    PATH_TEST_EQ(path("//net//foo//bar//").lexically_normal().generic_path(), "//net/foo/bar/.");
+    PATH_TEST_EQ(path("//net//foo//..").lexically_normal().generic_path(), "//net/");
+    PATH_TEST_EQ(path("//net//foo//..//").lexically_normal().generic_path(), "//net/.");
+
+    PATH_TEST_EQ(path("///net///foo///bar").lexically_normal().generic_path(), "/net/foo/bar");
+    PATH_TEST_EQ(path("///net///foo///bar///").lexically_normal().generic_path(), "/net/foo/bar/.");
+    PATH_TEST_EQ(path("///net///foo///..").lexically_normal().generic_path(), "/net");
+    PATH_TEST_EQ(path("///net///foo///..///").lexically_normal().generic_path(), "/net/.");
 
     if (platform == "Windows")
     {
-      PATH_TEST_EQ(path("c:..").lexically_normal().generic(), "c:..");
-      PATH_TEST_EQ(path("c:foo/..").lexically_normal().generic(), "c:");
-
-      PATH_TEST_EQ(path("c:foo/../").lexically_normal().generic(), "c:.");
-
-      PATH_TEST_EQ(path("c:/foo/..").lexically_normal().generic(), "c:/");
-      PATH_TEST_EQ(path("c:/foo/../").lexically_normal().generic(), "c:/.");
-      PATH_TEST_EQ(path("c:/..").lexically_normal().generic(), "c:/..");
-      PATH_TEST_EQ(path("c:/../").lexically_normal().generic(), "c:/../.");
-      PATH_TEST_EQ(path("c:/../..").lexically_normal().generic(), "c:/../..");
-      PATH_TEST_EQ(path("c:/../../").lexically_normal().generic(), "c:/../../.");
-      PATH_TEST_EQ(path("c:/../foo").lexically_normal().generic(), "c:/../foo");
-      PATH_TEST_EQ(path("c:/../foo/").lexically_normal().generic(), "c:/../foo/.");
-      PATH_TEST_EQ(path("c:/../../foo").lexically_normal().generic(), "c:/../../foo");
-      PATH_TEST_EQ(path("c:/../../foo/").lexically_normal().generic(), "c:/../../foo/.");
-      PATH_TEST_EQ(path("c:/..foo").lexically_normal().generic(), "c:/..foo");
+      PATH_TEST_EQ(path("c:..").lexically_normal().generic_path(), "c:..");
+      PATH_TEST_EQ(path("c:foo/..").lexically_normal().generic_path(), "c:");
+
+      PATH_TEST_EQ(path("c:foo/../").lexically_normal().generic_path(), "c:.");
+
+      PATH_TEST_EQ(path("c:/foo/..").lexically_normal().generic_path(), "c:/");
+      PATH_TEST_EQ(path("c:/foo/../").lexically_normal().generic_path(), "c:/.");
+      PATH_TEST_EQ(path("c:/..").lexically_normal().generic_path(), "c:/..");
+      PATH_TEST_EQ(path("c:/../").lexically_normal().generic_path(), "c:/../.");
+      PATH_TEST_EQ(path("c:/../..").lexically_normal().generic_path(), "c:/../..");
+      PATH_TEST_EQ(path("c:/../../").lexically_normal().generic_path(), "c:/../../.");
+      PATH_TEST_EQ(path("c:/../foo").lexically_normal().generic_path(), "c:/../foo");
+      PATH_TEST_EQ(path("c:/../foo/").lexically_normal().generic_path(), "c:/../foo/.");
+      PATH_TEST_EQ(path("c:/../../foo").lexically_normal().generic_path(), "c:/../../foo");
+      PATH_TEST_EQ(path("c:/../../foo/").lexically_normal().generic_path(), "c:/../../foo/.");
+      PATH_TEST_EQ(path("c:/..foo").lexically_normal().generic_path(), "c:/..foo");
     }
     else // POSIX
     {