| 2709 | // lexically_normal_tests ----------------------------------------------------------// |
| 2710 | |
| 2711 | void lexically_normal_tests() |
| 2712 | { |
| 2713 | std::cout << "lexically_normal_tests..." << std::endl; |
| 2714 | |
| 2715 | // Note: lexically_normal() uses /= to build up some results, so these results will |
| 2716 | // have the platform's preferred separator. Since that is immaterial to the correct |
| 2717 | // functioning of lexically_normal(), the test results are converted to generic form, |
| 2718 | // and the expected results are also given in generic form. Otherwise many of the |
| 2719 | // tests would incorrectly be reported as failing on Windows. |
| 2720 | |
| 2721 | PATH_TEST_EQ(path("").lexically_normal().generic_path(), ""); |
| 2722 | PATH_TEST_EQ(path("/").lexically_normal().generic_path(), "/"); |
| 2723 | PATH_TEST_EQ(path("//").lexically_normal().generic_path(), "//"); |
| 2724 | PATH_TEST_EQ(path("///").lexically_normal().generic_path(), "/"); |
| 2725 | PATH_TEST_EQ(path("f").lexically_normal().generic_path(), "f"); |
| 2726 | PATH_TEST_EQ(path("foo").lexically_normal().generic_path(), "foo"); |
| 2727 | PATH_TEST_EQ(path("foo/").lexically_normal().generic_path(), "foo/" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2728 | PATH_TEST_EQ(path("f/").lexically_normal().generic_path(), "f/" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2729 | PATH_TEST_EQ(path("/foo").lexically_normal().generic_path(), "/foo"); |
| 2730 | PATH_TEST_EQ(path("/./foo").lexically_normal().generic_path(), "/foo"); |
| 2731 | PATH_TEST_EQ(path("/./foo/.").lexically_normal().generic_path(), "/foo/" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2732 | PATH_TEST_EQ(path("foo/bar").lexically_normal().generic_path(), "foo/bar"); |
| 2733 | PATH_TEST_EQ(path("..").lexically_normal().generic_path(), ".."); |
| 2734 | PATH_TEST_EQ(path("../..").lexically_normal().generic_path(), "../.."); |
| 2735 | PATH_TEST_EQ(path("/..").lexically_normal().generic_path(), "/.."); |
| 2736 | PATH_TEST_EQ(path("/../..").lexically_normal().generic_path(), "/../.."); |
| 2737 | PATH_TEST_EQ(path("../foo").lexically_normal().generic_path(), "../foo"); |
| 2738 | PATH_TEST_EQ(path("foo/..").lexically_normal().generic_path(), "."); |
| 2739 | PATH_TEST_EQ(path("foo/../").lexically_normal().generic_path(), "."); |
| 2740 | PATH_TEST_EQ((path("foo") / "..").lexically_normal().generic_path(), "."); |
| 2741 | PATH_TEST_EQ(path("foo/...").lexically_normal().generic_path(), "foo/..."); |
| 2742 | PATH_TEST_EQ(path("foo/.../").lexically_normal().generic_path(), "foo/.../" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2743 | PATH_TEST_EQ(path("foo/..bar").lexically_normal().generic_path(), "foo/..bar"); |
| 2744 | PATH_TEST_EQ(path("../f").lexically_normal().generic_path(), "../f"); |
| 2745 | PATH_TEST_EQ(path("/../f").lexically_normal().generic_path(), "/../f"); |
| 2746 | PATH_TEST_EQ(path("f/..").lexically_normal().generic_path(), "."); |
| 2747 | PATH_TEST_EQ((path("f") / "..").lexically_normal().generic_path(), "."); |
| 2748 | PATH_TEST_EQ(path("foo/../..").lexically_normal().generic_path(), ".."); |
| 2749 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2750 | PATH_TEST_EQ(path("foo/../../").lexically_normal().generic_path(), "../."); |
| 2751 | #else |
| 2752 | PATH_TEST_EQ(path("foo/../../").lexically_normal().generic_path(), ".."); |
| 2753 | #endif |
| 2754 | PATH_TEST_EQ(path("foo/../../..").lexically_normal().generic_path(), "../.."); |
| 2755 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2756 | PATH_TEST_EQ(path("foo/../../../").lexically_normal().generic_path(), "../../."); |
| 2757 | #else |
| 2758 | PATH_TEST_EQ(path("foo/../../../").lexically_normal().generic_path(), "../.."); |
| 2759 | #endif |
| 2760 | PATH_TEST_EQ(path("foo/../bar").lexically_normal().generic_path(), "bar"); |
| 2761 | PATH_TEST_EQ(path("foo/../bar/").lexically_normal().generic_path(), "bar/" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2762 | PATH_TEST_EQ(path("foo/bar/..").lexically_normal().generic_path(), "foo"); |
| 2763 | PATH_TEST_EQ(path("foo/./bar/..").lexically_normal().generic_path(), "foo"); |
| 2764 | std::cout << path("foo/./bar/..").lexically_normal() << std::endl; // outputs "foo" |
| 2765 | PATH_TEST_EQ(path("foo/bar/../").lexically_normal().generic_path(), "foo/" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2766 | PATH_TEST_EQ(path("foo/./bar/../").lexically_normal().generic_path(), "foo/" BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 2767 | std::cout << path("foo/./bar/../").lexically_normal() << std::endl; // POSIX: "foo/", Windows: "foo\" (with a trailing dot for v3) |
| 2768 | PATH_TEST_EQ(path("foo/bar/../..").lexically_normal().generic_path(), "."); |
no test coverage detected