aboutsummaryrefslogtreecommitdiff
path: root/tests/expansion/type.test
blob: 1aae5b67036d0d2347b6dc6009bec5cd57645f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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'