1 |
#### fastlex: NUL byte not allowed inside char literal #' ' |
2 |
|
3 |
echo $'var x = #\'\x00\'; echo x=$x' > tmp.oil |
4 |
$SH tmp.oil |
5 |
|
6 |
echo $'var x = #\' ' > incomplete.oil |
7 |
$SH incomplete.oil |
8 |
|
9 |
## status: 2 |
10 |
## STDOUT: |
11 |
## END |
12 |
|
13 |
#### fastlex: NUL byte inside shebang line |
14 |
|
15 |
# Hm this test doesn't really tickle the bug |
16 |
|
17 |
echo $'#! /usr/bin/env \x00 sh \necho hi' > tmp.oil |
18 |
env OSH_HIJACK_SHEBANG=1 $SH tmp.oil |
19 |
|
20 |
## STDOUT: |
21 |
hi |
22 |
## END |
23 |
|
24 |
#### Tea keywords don't interfere with Oil expressions |
25 |
|
26 |
var d = {data: 'foo'} |
27 |
|
28 |
echo $[d->data] |
29 |
|
30 |
var e = {enum: 1, class: 2, import: 3, const: 4, var: 5, set: 6} |
31 |
echo $len(e) |
32 |
|
33 |
## STDOUT: |
34 |
foo |
35 |
6 |
36 |
## END |
37 |
|
38 |
#### Catch AttributeError |
39 |
|
40 |
var s = 'foo' |
41 |
echo s=$s |
42 |
var t = s.bad() |
43 |
echo 'should not get here' |
44 |
|
45 |
## status: 3 |
46 |
## STDOUT: |
47 |
s=foo |
48 |
## END |
49 |
|
50 |
|
51 |
#### Command sub paren parsing bug (#1387) |
52 |
|
53 |
write $(if (true) { write true }) |
54 |
|
55 |
const a = $(write $[len('foo')]) |
56 |
echo $a |
57 |
|
58 |
const b = $(write $[5 ** 3]) |
59 |
echo $b |
60 |
|
61 |
const c = $( |
62 |
write $[6 + 7] |
63 |
) |
64 |
echo $c |
65 |
|
66 |
## STDOUT: |
67 |
true |
68 |
3 |
69 |
125 |
70 |
13 |
71 |
## END |
72 |
|
73 |
|
74 |
#### More Command sub paren parsing |
75 |
|
76 |
write $( var mylist = ['for']; for x in (mylist) { echo $x } ) |
77 |
|
78 |
write $( echo while; while (false) { write hi } ) |
79 |
|
80 |
write $( if (true) { write 'if' } ) |
81 |
|
82 |
write $( if (false) { write 'if' } elif (true) { write 'elif' } ) |
83 |
|
84 |
## STDOUT: |
85 |
for |
86 |
while |
87 |
if |
88 |
elif |
89 |
## END |
90 |
|
91 |
|