aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/buildfile2
-rw-r--r--tests/function/buildfile7
-rw-r--r--tests/function/call/buildfile17
-rw-r--r--tests/function/call/test.out9
-rwxr-xr-xtests/function/call/test.sh3
-rw-r--r--tests/function/path/buildfile7
-rw-r--r--tests/function/path/testscript39
-rwxr-xr-xtests/test.sh1
8 files changed, 54 insertions, 31 deletions
diff --git a/tests/buildfile b/tests/buildfile
index b6799d5..cd5177e 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 = test/
+d = function/ test/
./: $d
include $d
diff --git a/tests/function/buildfile b/tests/function/buildfile
new file mode 100644
index 0000000..52288ca
--- /dev/null
+++ b/tests/function/buildfile
@@ -0,0 +1,7 @@
+# file : tests/function/buildfile
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+d = path/
+./: $d
+include $d
diff --git a/tests/function/call/buildfile b/tests/function/call/buildfile
deleted file mode 100644
index 136f652..0000000
--- a/tests/function/call/buildfile
+++ /dev/null
@@ -1,17 +0,0 @@
-$identity()
-$identity (a)
-$identity (a b c)
-$identity(sub/dir{x y z})
-
-print a$identity (b)c
-
-# Verify we can inhibit function call with quoting.
-#
-foo = FOO
-bar = BAR
-
-print $foo"($bar)"
-print "$foo"($bar)
-print "$foo""($bar)"
-
-./:
diff --git a/tests/function/call/test.out b/tests/function/call/test.out
deleted file mode 100644
index 88a852b..0000000
--- a/tests/function/call/test.out
+++ /dev/null
@@ -1,9 +0,0 @@
-identity()
-identity(a)
-identity(a b c)
-identity(sub/dir{x} sub/dir{y} sub/dir{z})
-identity(b)
-ac
-FOOBAR
-FOOBAR
-FOOBAR
diff --git a/tests/function/call/test.sh b/tests/function/call/test.sh
deleted file mode 100755
index c745b76..0000000
--- a/tests/function/call/test.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-b -q | diff --strip-trailing-cr -u test.out -
diff --git a/tests/function/path/buildfile b/tests/function/path/buildfile
new file mode 100644
index 0000000..db40358
--- /dev/null
+++ b/tests/function/path/buildfile
@@ -0,0 +1,7 @@
+# file : tests/function/path/buildfile
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+./: test{testscript}
+
+test{*}: test = $build.driver
diff --git a/tests/function/path/testscript b/tests/function/path/testscript
new file mode 100644
index 0000000..5656446
--- /dev/null
+++ b/tests/function/path/testscript
@@ -0,0 +1,39 @@
+# file : tests/function/path/testscript
+# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
++mkdir build
++cat <<EOI >>>build/boostrap.build
+project = test
+amalgamation =
+EOI
+
+test.options += -q --buildfile - noop
+
++if ($cxx.target.class != windows) # @@ TMP ternarry
+ s = '/'
+else
+ s = '\'
+end
+
+: normalize
+:
+{
+ $* <'print $normalize([path] a/../b/)' >"b" : path
+ $* <'print $normalize([paths] a/../b/ a/../c)' >"b c" : paths
+ $* <'print $normalize([dir_path] a/../b)' >"b$s" : dir-path
+ $* <'print $normalize([dir_paths] a/../b a/../c/)' >"b$s c$s" : dir-paths
+ $* <'print $path.normalize(a/../b)' >"b" : untyped
+ $* <'print $path.normalize(a/../b/ a/../b)' >"b$s b" : mixed
+}
+
+: invalid-path
+:
+if ($cxx.target.class != windows) # @@ TMP ternarry
+ p = /../foo
+else
+ p = c:/../foo
+end;
+$* <"\$path.normalize\($p)" 2>>EOE != 0
+error: invalid path: '$p'
+EOE
diff --git a/tests/test.sh b/tests/test.sh
index 9ce7152..de93322 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -15,7 +15,6 @@ function test ()
test "amalgam/unnamed"
test "escaping"
test "eval"
-test "function/call"
test "if-else"
test "keyword"
test "names"