diff options
author | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
commit | 60a979e224f26117f5be82bfca757a2483cef0fd (patch) | |
tree | 7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/cond.lua | |
parent | a19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff) | |
download | yuescript-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.lua | 272 |
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 @@ | |||
1 | local you_cool = false | ||
2 | local _ | ||
3 | if 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 | ||
14 | else | ||
15 | _ = no | ||
16 | end | ||
17 | if cool then | ||
18 | _ = no | ||
19 | end | ||
20 | if cool then | ||
21 | _ = no | ||
22 | else | ||
23 | _ = yes | ||
24 | end | ||
25 | if cool then | ||
26 | wow(cool) | ||
27 | else | ||
28 | noso(cool) | ||
29 | end | ||
30 | if working then | ||
31 | if cool then | ||
32 | if cool then | ||
33 | _ = okay | ||
34 | else | ||
35 | _ = what | ||
36 | end | ||
37 | else | ||
38 | _ = nah | ||
39 | end | ||
40 | end | ||
41 | if yeah then | ||
42 | no(day) | ||
43 | elseif cool(me) then | ||
44 | okay(ya) | ||
45 | else | ||
46 | u(way) | ||
47 | end | ||
48 | if yeah then | ||
49 | no(dad) | ||
50 | else | ||
51 | if cool(you) then | ||
52 | okay(bah) | ||
53 | else | ||
54 | p(way) | ||
55 | end | ||
56 | end | ||
57 | if (function() end)() then | ||
58 | what(ever) | ||
59 | end | ||
60 | if nil then | ||
61 | flip(me) | ||
62 | else | ||
63 | it(be, rad) | ||
64 | end | ||
65 | if things(great) then | ||
66 | no(way) | ||
67 | elseif okay(sure) then | ||
68 | what(here) | ||
69 | end | ||
70 | if things then | ||
71 | no(chance) | ||
72 | elseif okay then | ||
73 | what(now) | ||
74 | end | ||
75 | if things then | ||
76 | yes(man) | ||
77 | elseif okay(person) then | ||
78 | hi(there) | ||
79 | else | ||
80 | hmm(sure) | ||
81 | end | ||
82 | if lets(go) then | ||
83 | print("greetings") | ||
84 | elseif "just us" then | ||
85 | print("will smith") | ||
86 | else | ||
87 | show(5555555) | ||
88 | end | ||
89 | do | ||
90 | local something = 10 | ||
91 | if something then | ||
92 | print(something) | ||
93 | else | ||
94 | print("else") | ||
95 | end | ||
96 | end | ||
97 | local hello | ||
98 | do | ||
99 | local something = 10 | ||
100 | if something then | ||
101 | hello = print(something) | ||
102 | else | ||
103 | hello = print("else") | ||
104 | end | ||
105 | end | ||
106 | hello = 5 + (function() | ||
107 | local something = 10 | ||
108 | if something then | ||
109 | return print(something) | ||
110 | end | ||
111 | end)() | ||
112 | local z = false | ||
113 | if false then | ||
114 | _ = one | ||
115 | else | ||
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 | ||
129 | end | ||
130 | local out | ||
131 | if false then | ||
132 | out = one | ||
133 | else | ||
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 | ||
147 | end | ||
148 | local kzy | ||
149 | kzy = 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 | ||
163 | end | ||
164 | if not true then | ||
165 | print("cool!") | ||
166 | end | ||
167 | if not (true and false) then | ||
168 | print("cool!") | ||
169 | end | ||
170 | if not false then | ||
171 | print("cool!") | ||
172 | end | ||
173 | if not false then | ||
174 | print("cool!") | ||
175 | else | ||
176 | print("no way!") | ||
177 | end | ||
178 | if not nil then | ||
179 | print("hello") | ||
180 | else | ||
181 | print("world") | ||
182 | end | ||
183 | local x | ||
184 | if not true then | ||
185 | x = print("cool!") | ||
186 | end | ||
187 | if not (true and false) then | ||
188 | x = print("cool!") | ||
189 | end | ||
190 | local y | ||
191 | if not false then | ||
192 | y = print("cool!") | ||
193 | end | ||
194 | if not false then | ||
195 | y = print("cool!") | ||
196 | else | ||
197 | y = print("no way!") | ||
198 | end | ||
199 | if not nil then | ||
200 | z = print("hello") | ||
201 | else | ||
202 | z = print("world") | ||
203 | end | ||
204 | print((function() | ||
205 | if not true then | ||
206 | return print("cool!") | ||
207 | end | ||
208 | end)()) | ||
209 | print((function() | ||
210 | if not (true and false) then | ||
211 | return print("cool!") | ||
212 | end | ||
213 | end)()) | ||
214 | print((function() | ||
215 | if not false then | ||
216 | return print("cool!") | ||
217 | end | ||
218 | end)()) | ||
219 | print((function() | ||
220 | if not false then | ||
221 | return print("cool!") | ||
222 | else | ||
223 | return print("no way!") | ||
224 | end | ||
225 | end)()) | ||
226 | print((function() | ||
227 | if not nil then | ||
228 | return print("hello") | ||
229 | else | ||
230 | return print("world") | ||
231 | end | ||
232 | end)()) | ||
233 | if not value then | ||
234 | print("hello") | ||
235 | end | ||
236 | local dddd | ||
237 | if not value then | ||
238 | dddd = { | ||
239 | 1, | ||
240 | 2, | ||
241 | 3 | ||
242 | } | ||
243 | end | ||
244 | do | ||
245 | local j = 100 | ||
246 | j = hi() | ||
247 | if not j then | ||
248 | error("not j!") | ||
249 | end | ||
250 | end | ||
251 | local a = 12 | ||
252 | local c, b | ||
253 | if something then | ||
254 | a, c, b = "cool" | ||
255 | end | ||
256 | local j | ||
257 | if 1 then | ||
258 | if 2 then | ||
259 | j = 3 | ||
260 | end | ||
261 | else | ||
262 | j = 6 | ||
263 | end | ||
264 | local m | ||
265 | if 1 then | ||
266 | if 2 then | ||
267 | m = 3 | ||
268 | end | ||
269 | else | ||
270 | m = 6 | ||
271 | end | ||
272 | return nil | ||