aboutsummaryrefslogtreecommitdiff
path: root/tests/build/path
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-28 16:13:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-28 16:13:54 +0200
commit56ce5687567150b0b2cc3e57540d564793ef6bf7 (patch)
tree79b3cef1169b82f8d85459b285e2fc39f9d8a0e9 /tests/build/path
parent9d818423031083f227a5e872826ed8c2d6e14a0f (diff)
Add support for iteration over path components
Diffstat (limited to 'tests/build/path')
-rw-r--r--tests/build/path/driver.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/build/path/driver.cxx b/tests/build/path/driver.cxx
index 739146b..3aa624c 100644
--- a/tests/build/path/driver.cxx
+++ b/tests/build/path/driver.cxx
@@ -77,6 +77,40 @@ main ()
assert (path ("C:\\foo.txt").base ().string () == "C:\\foo");
#endif
+ // iteration
+ //
+ {
+ path p;
+ assert (p.begin () == p.end ());
+ }
+ {
+ path p ("foo");
+ path::iterator i (p.begin ());
+ assert (i != p.end () && *i == "foo");
+ assert (++i == p.end ());
+ }
+ {
+ path p ("foo/bar");
+ path::iterator i (p.begin ());
+ assert (i != p.end () && *i == "foo");
+ assert (++i != p.end () && *i == "bar");
+ assert (++i == p.end ());
+ }
+ {
+ path p ("/foo/bar");
+ path::iterator i (p.begin ());
+ assert (i != p.end () && *i == "");
+ assert (++i != p.end () && *i == "foo");
+ assert (++i != p.end () && *i == "bar");
+ assert (++i == p.end ());
+ }
+ {
+ path p ("/");
+ path::iterator i (p.begin ());
+ assert (i != p.end () && *i == "");
+ assert (++i == p.end ());
+ }
+
// operator/
//
#ifndef _WIN32