aboutsummaryrefslogtreecommitdiff
path: root/tests/function/path/testscript
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-18 17:28:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-18 17:30:47 +0200
commit6b7075adc71104c5f6ad652b99fb753565eb67d8 (patch)
tree1f4d91b7cd9ee7cca793f0ecc504ccc4d8dde0d2 /tests/function/path/testscript
parentdd008d6e48b0bb66e1b9fdc489d9d1d9b4cb8d25 (diff)
Add function machinery, implement path.normalize()
Note that multi-argument functions are not yet "callable" since there is no support for value packs.
Diffstat (limited to 'tests/function/path/testscript')
-rw-r--r--tests/function/path/testscript39
1 files changed, 39 insertions, 0 deletions
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