aboutsummaryrefslogtreecommitdiff
path: root/tests/value
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-01 15:13:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-01 15:13:30 +0200
commit5e71edfa033f163ded9a82f7d66412d8ee05bc48 (patch)
tree071c3a9068fb134d7cc64c1fcc16d30cdaa3455a /tests/value
parent6cb960121c4195dd9d12c92d4f3ff2819fad143e (diff)
Port old value reversibility tests
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
+}