aboutsummaryrefslogtreecommitdiff
path: root/tests/path
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-29 12:10:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-29 12:10:04 +0200
commit288718b4977058bdcf692422173f3642b0aa4d1d (patch)
treec4662107ff71c48b77a8058b655ddaff0e015d22 /tests/path
parent82b9af71dd5aa3ad6fee808e91e9b1024ebaeafb (diff)
Add path::combine(string,separator)
In particular, this can be used to recombine a path during iteration: dir_path r; for (auto i (d.begin ()); i != d.end (); ++i) r.combine (*i, i.separator ());
Diffstat (limited to 'tests/path')
-rw-r--r--tests/path/driver.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/path/driver.cxx b/tests/path/driver.cxx
index 28da0a0..b855e34 100644
--- a/tests/path/driver.cxx
+++ b/tests/path/driver.cxx
@@ -208,6 +208,15 @@ main ()
assert (++i != p.end () && *i == "bar" && i.separator () == '\0');
assert (++i == p.end ());
}
+ /*
+ {
+ path p ("foo//bar");
+ path::iterator i (p.begin ());
+ assert (i != p.end () && *i == "foo" && i.separator () == '/');
+ assert (++i != p.end () && *i == "bar" && i.separator () == '\0');
+ assert (++i == p.end ());
+ }
+ */
{
path p ("foo/bar/");
path::iterator i (p.begin ());
@@ -251,6 +260,15 @@ main ()
assert (i != p.rend () && *i == "");
assert (++i == p.rend ());
}
+#else
+ {
+ path p ("C:\\foo\\bar");
+ path::iterator i (p.begin ());
+ assert (i != p.end () && *i == "C:");
+ assert (++i != p.end () && *i == "foo");
+ assert (++i != p.end () && *i == "bar");
+ assert (++i == p.end ());
+ }
#endif
// iterator range construction
@@ -318,6 +336,7 @@ main ()
assert ((path ("foo/") / path ()).representation () == "foo/");
#else
assert ((path ("C:\\") / path ("tmp")).representation () == "C:\\tmp");
+ assert ((path ("C:") / path ("tmp")).representation () == "C:\\tmp");
assert ((path ("foo\\") / path ("bar")).representation () == "foo\\bar");
assert ((path ("foo\\") / path ("bar\\")).representation () == "foo\\bar\\");
assert ((path ("foo\\") / path ("bar/")).representation () == "foo\\bar/");