aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/buildfile2
-rw-r--r--tests/value/buildfile5
-rw-r--r--tests/value/reverse.test76
3 files changed, 82 insertions, 1 deletions
diff --git a/tests/buildfile b/tests/buildfile
index 0c2a895..b05e2e7 100644
--- a/tests/buildfile
+++ b/tests/buildfile
@@ -2,6 +2,6 @@
# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-d = directive/ expansion/ function/ test/
+d = directive/ expansion/ function/ test/ value/
./: $d file{common.test}
include $d
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
+}