From 5e71edfa033f163ded9a82f7d66412d8ee05bc48 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 1 Dec 2016 15:13:30 +0200 Subject: Port old value reversibility tests --- tests/buildfile | 2 +- tests/value/buildfile | 5 ++++ tests/value/reverse.test | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 tests/value/buildfile create mode 100644 tests/value/reverse.test (limited to 'tests') 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 +: +$* <>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 +: +$* <>EOO +print ([strings] foo%bar foo% %bar) +EOI +foo%bar foo% %bar +EOO + +: name-pair +: +$* <>EOO +print ([strings] foo@bar foo/@bar/ foo@ @bar @ "@@") +EOI +foo@bar foo/@bar/ foo@ @bar @ @@ +EOO + +: name-combined +: +$* <>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)); +$* <>"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) +{ + $* <>EOO + x = [dir_path] / + print ([string] $x) + print "$x" + print "-I$x" + EOI + / + / + -I/ + EOO +} -- cgit v1.1