diff options
Diffstat (limited to 'tests/function')
-rw-r--r-- | tests/function/buildfile | 2 | ||||
-rw-r--r-- | tests/function/builtin/buildfile | 7 | ||||
-rw-r--r-- | tests/function/builtin/testscript | 68 |
3 files changed, 76 insertions, 1 deletions
diff --git a/tests/function/buildfile b/tests/function/buildfile index 52288ca..6c26737 100644 --- a/tests/function/buildfile +++ b/tests/function/buildfile @@ -2,6 +2,6 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -d = path/ +d = builtin/ path/ ./: $d include $d diff --git a/tests/function/builtin/buildfile b/tests/function/builtin/buildfile new file mode 100644 index 0000000..5a49ad0 --- /dev/null +++ b/tests/function/builtin/buildfile @@ -0,0 +1,7 @@ +# file : tests/function/builtin/buildfile +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +./: test{testscript} + +test{*}: test = $effect($build.path) diff --git a/tests/function/builtin/testscript b/tests/function/builtin/testscript new file mode 100644 index 0000000..1a4c5d1 --- /dev/null +++ b/tests/function/builtin/testscript @@ -0,0 +1,68 @@ +# file : tests/function/path/testscript +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + ++mkdir build ++cat <<EOI >>>build/bootstrap.build +project = test +amalgamation = +EOI + +test.options += -q --buildfile - noop + +: type +: +{ + $* <'print $type([string])' >'string' : empty-typed + $* <'print $type("")' >'' : empty-untyped + + $* <'print $type([string null])' >'string' : null-typed + $* <'print $type([null])' >'' : null-untyped + + $* <'print $type([string] abc)' >'string' : value-typed + $* <'print $type(abc)' >'' : value-untyped +} + +: null +: +{ + $* <'print $null("")' >'false' : empty + $* <'print $null(abc)' >'false' : value + $* <'print $null([null])' >'true' : null +} + +: empty +: +{ + $* <<EOI >'true' : empty-untyped + x = + print \$empty\(\$x) + EOI + + $* <'print $empty([string])' >'true' : empty-typed + $* <'print $empty(abc)' >'false' : name + $* <'print $empty(abc cxx{foo})' >'false' : names + $* <'print $empty([bool] false)' >'false' : bool +} + +: identity +: +{ + $* <'print $identity([string])' >''; + $* <'print $type($identity([string]))' >'string' : empty-typed + + $* <'print $identity("")' >'{}'; + $* <'print $type($identity(""))' >'' : empty-untyped + + $* <'print $identity([string null])' >'[null]'; + $* <'print $type($identity([string null]))' >'string' : null-typed + + $* <'print $identity([null])' >'[null]'; + $* <'print $type($identity([null]))' >'' : null-untyped + + $* <'print $identity([string] abc)' >'abc'; + $* <'print $type($identity([string] abc))' >'string' : null-typed + + $* <'print $identity(abc)' >'abc'; + $* <'print $type($identity(abc))' >'' : null-untyped +} |