diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/buildfile | 2 | ||||
-rw-r--r-- | tests/expansion/buildfile | 7 | ||||
-rw-r--r-- | tests/expansion/common.test | 11 | ||||
-rw-r--r-- | tests/expansion/type.test | 53 | ||||
-rw-r--r-- | tests/test/script/builtin/touch.test | 2 | ||||
-rw-r--r-- | tests/variable/dir-path/buildfile | 6 |
6 files changed, 76 insertions, 5 deletions
diff --git a/tests/buildfile b/tests/buildfile index f38b3ca..405df8f 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/ function/ test/ +d = directive/ expansion/ function/ test/ ./: $d include $d diff --git a/tests/expansion/buildfile b/tests/expansion/buildfile new file mode 100644 index 0000000..81df59e --- /dev/null +++ b/tests/expansion/buildfile @@ -0,0 +1,7 @@ +# file : tests/expansion/buildfile +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +./: test{type} file{common.test} + +test{*}: test = $effect($build.path) diff --git a/tests/expansion/common.test b/tests/expansion/common.test new file mode 100644 index 0000000..881c74e --- /dev/null +++ b/tests/expansion/common.test @@ -0,0 +1,11 @@ +# file : tests/expansion/assert.test +# 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 diff --git a/tests/expansion/type.test b/tests/expansion/type.test new file mode 100644 index 0000000..1aae5b6 --- /dev/null +++ b/tests/expansion/type.test @@ -0,0 +1,53 @@ +# file : tests/expansion/type.test +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +# Test type propagation during expansion. + +.include common.test + +: var +: +$* <<EOI +x = [bool] true +y = \$x +assert \(\$type\(\$y) == bool) +EOI + +: eval +: +$* <<EOI +y = \([bool] true) +assert \(\$type\(\$y) == bool) +EOI + +: func +: +$* <<EOI +y = \$identity\([bool] true) +assert \(\$type\(\$y) == bool) +EOI + +: untypify +: +$* <<EOI +x = [bool] true +y = "\$x" +assert \(\$type\(\$y) == "") +EOI + +: type-conflict +: +$* <'print [bool] ([string] true)' 2>>EOE != 0 +<stdin>:1:7: error: conflicting attribute type bool and value type string + info: use quoting to untypify the value +EOE + +: retypify +: +$* <'print [bool] "([string] true)"' >'true' + +: retypify-name +: Test the "steal" case of untypify() +: +$* <'print [bool] "([name] true)"' >'true' diff --git a/tests/test/script/builtin/touch.test b/tests/test/script/builtin/touch.test index 4d2ff57..ef950ea 100644 --- a/tests/test/script/builtin/touch.test +++ b/tests/test/script/builtin/touch.test @@ -39,7 +39,7 @@ touch '' 2>"touch: invalid path ''" == 1 : : Test touching an existing directory. : -a = [path] $~; +a = $~; a += "a"; mkdir a; touch 2>"touch: '$a' exists and is not a file" a == 1 diff --git a/tests/variable/dir-path/buildfile b/tests/variable/dir-path/buildfile index 5c99f07..c6fdb46 100644 --- a/tests/variable/dir-path/buildfile +++ b/tests/variable/dir-path/buildfile @@ -27,7 +27,7 @@ print [strings] -I $y print -I $y/baz print -z = [strings] $x # Re-typed. +z = [strings] "$x" # Re-typed. print $z print @@ -37,9 +37,9 @@ r = [dir_path] / print $r/foo r += foo -print [strings] $r +print [strings] "$r" r += bar -print [strings] $r +print [strings] "$r" ./: |