Lines Matching refs:path

63 // Test cases for the "path" class.
69 set_md_var("descr", "Tests the path's normalization");
73 using atf::fs::path;
75 ATF_REQUIRE_EQ(path(".").str(), ".");
76 ATF_REQUIRE_EQ(path("..").str(), "..");
78 ATF_REQUIRE_EQ(path("foo").str(), "foo");
79 ATF_REQUIRE_EQ(path("foo/bar").str(), "foo/bar");
80 ATF_REQUIRE_EQ(path("foo/bar/").str(), "foo/bar");
82 ATF_REQUIRE_EQ(path("/foo").str(), "/foo");
83 ATF_REQUIRE_EQ(path("/foo/bar").str(), "/foo/bar");
84 ATF_REQUIRE_EQ(path("/foo/bar/").str(), "/foo/bar");
86 ATF_REQUIRE_EQ(path("///foo").str(), "/foo");
87 ATF_REQUIRE_EQ(path("///foo///bar").str(), "/foo/bar");
88 ATF_REQUIRE_EQ(path("///foo///bar///").str(), "/foo/bar");
94 set_md_var("descr", "Tests the path::is_absolute function");
98 using atf::fs::path;
100 ATF_REQUIRE( path("/").is_absolute());
101 ATF_REQUIRE( path("////").is_absolute());
102 ATF_REQUIRE( path("////a").is_absolute());
103 ATF_REQUIRE( path("//a//").is_absolute());
104 ATF_REQUIRE(!path("a////").is_absolute());
105 ATF_REQUIRE(!path("../foo").is_absolute());
111 set_md_var("descr", "Tests the path::is_root function");
115 using atf::fs::path;
117 ATF_REQUIRE( path("/").is_root());
118 ATF_REQUIRE( path("////").is_root());
119 ATF_REQUIRE(!path("////a").is_root());
120 ATF_REQUIRE(!path("//a//").is_root());
121 ATF_REQUIRE(!path("a////").is_root());
122 ATF_REQUIRE(!path("../foo").is_root());
128 set_md_var("descr", "Tests the path::branch_path function");
132 using atf::fs::path;
134 ATF_REQUIRE_EQ(path(".").branch_path().str(), ".");
135 ATF_REQUIRE_EQ(path("foo").branch_path().str(), ".");
136 ATF_REQUIRE_EQ(path("foo/bar").branch_path().str(), "foo");
137 ATF_REQUIRE_EQ(path("/foo").branch_path().str(), "/");
138 ATF_REQUIRE_EQ(path("/foo/bar").branch_path().str(), "/foo");
144 set_md_var("descr", "Tests the path::leaf_name function");
148 using atf::fs::path;
150 ATF_REQUIRE_EQ(path(".").leaf_name(), ".");
151 ATF_REQUIRE_EQ(path("foo").leaf_name(), "foo");
152 ATF_REQUIRE_EQ(path("foo/bar").leaf_name(), "bar");
153 ATF_REQUIRE_EQ(path("/foo").leaf_name(), "foo");
154 ATF_REQUIRE_EQ(path("/foo/bar").leaf_name(), "bar");
164 using atf::fs::path;
166 ATF_REQUIRE(path("/") == path("///"));
167 ATF_REQUIRE(path("/a") == path("///a"));
168 ATF_REQUIRE(path("/a") == path("///a///"));
170 ATF_REQUIRE(path("a/b/c") == path("a//b//c"));
171 ATF_REQUIRE(path("a/b/c") == path("a//b//c///"));
181 using atf::fs::path;
183 ATF_REQUIRE(path("/") != path("//a/"));
184 ATF_REQUIRE(path("/a") != path("a///"));
186 ATF_REQUIRE(path("a/b/c") != path("a/b"));
187 ATF_REQUIRE(path("a/b/c") != path("a//b"));
188 ATF_REQUIRE(path("a/b/c") != path("/a/b/c"));
189 ATF_REQUIRE(path("a/b/c") != path("/a//b//c"));
199 using atf::fs::path;
201 ATF_REQUIRE_EQ((path("foo") / "bar").str(), "foo/bar");
202 ATF_REQUIRE_EQ((path("foo/") / "/bar").str(), "foo/bar");
203 ATF_REQUIRE_EQ((path("foo/") / "/bar/baz").str(), "foo/bar/baz");
204 ATF_REQUIRE_EQ((path("foo/") / "///bar///baz").str(), "foo/bar/baz");
210 set_md_var("descr", "Tests the conversion of a relative path to an "
216 using atf::fs::path;
221 const path p(".");
222 path pa = p.to_absolute();
232 const path p("files/reg");
233 path pa = p.to_absolute();
246 set_md_var("descr", "Tests that the path's less-than operator works");
250 using atf::fs::path;
254 ATF_REQUIRE(!(path("aaa") < path("aaa")));
256 ATF_REQUIRE( path("aab") < path("abc"));
257 ATF_REQUIRE(!(path("abc") < path("aab")));
273 using atf::fs::path;
277 directory d(path("files"));
295 using atf::fs::path;
299 directory d(path("files"));
324 using atf::fs::path;
328 directory d(path("files"));
349 using atf::fs::path;
354 path p("files/dir");
360 path p("files/reg");
375 using atf::fs::path;
377 path p("file");
450 using atf::fs::path;
454 ATF_REQUIRE( exists(path("files")));
455 ATF_REQUIRE(!exists(path("file")));
456 ATF_REQUIRE(!exists(path("files2")));
458 ATF_REQUIRE( exists(path("files/.")));
459 ATF_REQUIRE( exists(path("files/..")));
460 ATF_REQUIRE( exists(path("files/dir")));
461 ATF_REQUIRE( exists(path("files/reg")));
462 ATF_REQUIRE(!exists(path("files/foo")));
473 using atf::fs::path;
477 ATF_REQUIRE( is_executable(path("files")));
478 ATF_REQUIRE( is_executable(path("files/.")));
479 ATF_REQUIRE( is_executable(path("files/..")));
480 ATF_REQUIRE( is_executable(path("files/dir")));
482 ATF_REQUIRE(!is_executable(path("non-existent")));
484 ATF_REQUIRE(!is_executable(path("files/reg")));
486 ATF_REQUIRE( is_executable(path("files/reg")));
497 using atf::fs::path;
502 ATF_REQUIRE( exists(path("files/reg")));
503 remove(path("files/reg"));
504 ATF_REQUIRE(!exists(path("files/reg")));
506 ATF_REQUIRE( exists(path("files/dir")));
507 ATF_REQUIRE_THROW(atf::system_error, remove(path("files/dir")));
508 ATF_REQUIRE( exists(path("files/dir")));
517 // Add the tests for the "path" class.