aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/cond.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
committerLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
commit60a979e224f26117f5be82bfca757a2483cef0fd (patch)
tree7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/cond.lua
parenta19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff)
downloadyuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip
fix test.
Diffstat (limited to 'spec/outputs/cond.lua')
-rw-r--r--spec/outputs/cond.lua272
1 files changed, 272 insertions, 0 deletions
diff --git a/spec/outputs/cond.lua b/spec/outputs/cond.lua
new file mode 100644
index 0000000..5efa237
--- /dev/null
+++ b/spec/outputs/cond.lua
@@ -0,0 +1,272 @@
1local you_cool = false
2local _
3if cool then
4 if you_cool then
5 _ = one
6 else
7 if eatdic then
8 _ = yeah
9 else
10 _ = two
11 _ = three
12 end
13 end
14else
15 _ = no
16end
17if cool then
18 _ = no
19end
20if cool then
21 _ = no
22else
23 _ = yes
24end
25if cool then
26 wow(cool)
27else
28 noso(cool)
29end
30if working then
31 if cool then
32 if cool then
33 _ = okay
34 else
35 _ = what
36 end
37 else
38 _ = nah
39 end
40end
41if yeah then
42 no(day)
43elseif cool(me) then
44 okay(ya)
45else
46 u(way)
47end
48if yeah then
49 no(dad)
50else
51 if cool(you) then
52 okay(bah)
53 else
54 p(way)
55 end
56end
57if (function() end)() then
58 what(ever)
59end
60if nil then
61 flip(me)
62else
63 it(be, rad)
64end
65if things(great) then
66 no(way)
67elseif okay(sure) then
68 what(here)
69end
70if things then
71 no(chance)
72elseif okay then
73 what(now)
74end
75if things then
76 yes(man)
77elseif okay(person) then
78 hi(there)
79else
80 hmm(sure)
81end
82if lets(go) then
83 print("greetings")
84elseif "just us" then
85 print("will smith")
86else
87 show(5555555)
88end
89do
90 local something = 10
91 if something then
92 print(something)
93 else
94 print("else")
95 end
96end
97local hello
98do
99 local something = 10
100 if something then
101 hello = print(something)
102 else
103 hello = print("else")
104 end
105end
106hello = 5 + (function()
107 local something = 10
108 if something then
109 return print(something)
110 end
111end)()
112local z = false
113if false then
114 _ = one
115else
116 do
117 local x = true
118 if x then
119 _ = two
120 else
121 z = true
122 if z then
123 _ = three
124 else
125 _ = four
126 end
127 end
128 end
129end
130local out
131if false then
132 out = one
133else
134 do
135 local x = true
136 if x then
137 out = two
138 else
139 z = true
140 if z then
141 out = three
142 else
143 out = four
144 end
145 end
146 end
147end
148local kzy
149kzy = function()
150 do
151 local something = true
152 if something then
153 return 1
154 else
155 do
156 local another = false
157 if another then
158 return 2
159 end
160 end
161 end
162 end
163end
164if not true then
165 print("cool!")
166end
167if not (true and false) then
168 print("cool!")
169end
170if not false then
171 print("cool!")
172end
173if not false then
174 print("cool!")
175else
176 print("no way!")
177end
178if not nil then
179 print("hello")
180else
181 print("world")
182end
183local x
184if not true then
185 x = print("cool!")
186end
187if not (true and false) then
188 x = print("cool!")
189end
190local y
191if not false then
192 y = print("cool!")
193end
194if not false then
195 y = print("cool!")
196else
197 y = print("no way!")
198end
199if not nil then
200 z = print("hello")
201else
202 z = print("world")
203end
204print((function()
205 if not true then
206 return print("cool!")
207 end
208end)())
209print((function()
210 if not (true and false) then
211 return print("cool!")
212 end
213end)())
214print((function()
215 if not false then
216 return print("cool!")
217 end
218end)())
219print((function()
220 if not false then
221 return print("cool!")
222 else
223 return print("no way!")
224 end
225end)())
226print((function()
227 if not nil then
228 return print("hello")
229 else
230 return print("world")
231 end
232end)())
233if not value then
234 print("hello")
235end
236local dddd
237if not value then
238 dddd = {
239 1,
240 2,
241 3
242 }
243end
244do
245 local j = 100
246 j = hi()
247 if not j then
248 error("not j!")
249 end
250end
251local a = 12
252local c, b
253if something then
254 a, c, b = "cool"
255end
256local j
257if 1 then
258 if 2 then
259 j = 3
260 end
261else
262 j = 6
263end
264local m
265if 1 then
266 if 2 then
267 m = 3
268 end
269else
270 m = 6
271end
272return nil