aboutsummaryrefslogtreecommitdiff
path: root/tests/value
diff options
context:
space:
mode:
Diffstat (limited to 'tests/value')
-rw-r--r--tests/value/buildfile5
-rw-r--r--tests/value/reverse.test76
2 files changed, 81 insertions, 0 deletions
diff --git a/tests/value/buildfile b/tests/value/buildfile
new file mode 100644
index 0000000..48480ad
--- /dev/null
+++ b/tests/value/buildfile
@@ -0,0 +1,5 @@
+# file : tests/value/buildfile
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+./: test{reverse}
diff --git a/tests/value/reverse.test b/tests/value/reverse.test
new file mode 100644
index 0000000..2ebfe68
--- /dev/null
+++ b/tests/value/reverse.test
@@ -0,0 +1,76 @@
+# file : tests/directive/reverse.test
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Test reversal to canonical/original representation.
+#
+
+.include ../common.test
+
+: name-dir
+:
+$* <<EOI >>EOO
+x = s/foo/bar/
+print ([string] $x)
+print "$x"
+print -e=$x
+EOI
+s/foo/bar/
+s/foo/bar/
+-e=s/foo/bar/
+EOO
+
+: name-proj
+:
+$* <<EOI >>EOO
+print ([strings] foo%bar foo% %bar)
+EOI
+foo%bar foo% %bar
+EOO
+
+: name-pair
+:
+$* <<EOI >>EOO
+print ([strings] foo@bar foo/@bar/ foo@ @bar @ "@@")
+EOI
+foo@bar foo/@bar/ foo@ @bar @ @@
+EOO
+
+: name-combined
+:
+$* <<EOI >>EOO
+print ([strings] x%foo@y%bar x%foo/@y%bar/)
+EOI
+x%foo@y%bar x%foo/@y%bar/
+EOO
+
+: dir-path
+:
+r = ([string] $path.canonicalize(foo/bar/));
+s = ([string] $path.canonicalize(foo/bar));
+$* <<EOI >>"EOO"
+x = [dir_path] foo/bar/
+print ([string] $x)
+print "$x"
+print "-I$x"
+EOI
+$r
+$s
+-I$s
+EOO
+
+: dir-path-root
+:
+if ($cxx.target.class != windows)
+{
+ $* <<EOI >>EOO
+ x = [dir_path] /
+ print ([string] $x)
+ print "$x"
+ print "-I$x"
+ EOI
+ /
+ /
+ -I/
+ EOO
+}