| 2866 | // weakly_canonical_basic_tests ----------------------------------------------------// |
| 2867 | |
| 2868 | void weakly_canonical_basic_tests() |
| 2869 | { |
| 2870 | cout << "weakly_canonical_basic_tests..." << endl; |
| 2871 | cout << " dir is " << dir << endl; |
| 2872 | |
| 2873 | // Note: Use cacnonical form of the root path in all paths to make path comparisons more stable |
| 2874 | const fs::path cur_path = canonicalize_root_path(fs::current_path()); |
| 2875 | |
| 2876 | BOOST_TEST_EQ(fs::weakly_canonical("no-such/foo/bar"), cur_path / fs::path("no-such/foo/bar")); |
| 2877 | BOOST_TEST_EQ(fs::weakly_canonical("no-such/foo/../bar"), cur_path / fs::path("no-such/bar")); |
| 2878 | BOOST_TEST_EQ(fs::weakly_canonical(dir), dir); |
| 2879 | BOOST_TEST_EQ(fs::weakly_canonical(dir / "no-such/foo/bar"), dir / "no-such/foo/bar"); |
| 2880 | BOOST_TEST_EQ(fs::weakly_canonical(dir / "no-such/foo/../bar"), dir / "no-such/bar"); |
| 2881 | BOOST_TEST_EQ(fs::weakly_canonical(dir / "../no-such/foo/../bar"), dir.parent_path() / "no-such/bar"); |
| 2882 | BOOST_TEST_EQ(fs::weakly_canonical(dir / "no-such/../f0"), dir / "f0"); // dir / "f0" exists, dir / "no-such" does not |
| 2883 | BOOST_TEST_EQ(fs::weakly_canonical("f0", d1), d1 / "f0"); |
| 2884 | BOOST_TEST_EQ(fs::weakly_canonical("./f0", d1), d1 / "f0"); |
| 2885 | BOOST_TEST_EQ(fs::weakly_canonical("./foo", d1), d1 / "foo"); |
| 2886 | BOOST_TEST_EQ(fs::weakly_canonical("../f0", d1), dir / "f0"); |
| 2887 | BOOST_TEST_EQ(fs::weakly_canonical("../foo", d1), dir / "foo"); |
| 2888 | BOOST_TEST_EQ(fs::weakly_canonical("..//foo", d1), dir / "foo"); |
| 2889 | |
| 2890 | #ifdef BOOST_FILESYSTEM_WINDOWS_API |
| 2891 | BOOST_TEST_EQ(fs::weakly_canonical("c:/no-such/foo/bar"), fs::path("C:/no-such/foo/bar")); |
| 2892 | |
| 2893 | // Test Windows long paths |
| 2894 | fs::path long_path = make_long_path(dir / L"f0"); |
| 2895 | BOOST_TEST_EQ(fs::weakly_canonical(long_path), long_path); |
| 2896 | |
| 2897 | long_path = make_long_path(dir / L"no-such/foo/bar"); |
| 2898 | BOOST_TEST_EQ(fs::weakly_canonical(long_path), long_path); |
| 2899 | #endif |
| 2900 | } |
| 2901 | |
| 2902 | // weakly_canonical_symlink_tests --------------------------------------------------// |
| 2903 |
no test coverage detected