summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-07-14 17:39:58 +0800
committerLi Jin <dragon-fly@qq.com>2022-07-14 17:39:58 +0800
commite4a719344f2d3bf6008d15949baf60fa68420135 (patch)
tree6cdfccd1bda7df3970136a3a7656eb339f3fb92b
parentf7b674213bd996016cb94c44ef22736a6cbdf6f3 (diff)
downloadyuescript-0.13.6.tar.gz
yuescript-0.13.6.tar.bz2
yuescript-0.13.6.zip
add spec.v0.13.6
-rw-r--r--spec/inputs/switch.yue10
-rw-r--r--spec/outputs/switch.lua28
2 files changed, 38 insertions, 0 deletions
diff --git a/spec/inputs/switch.yue b/spec/inputs/switch.yue
index 08330bf..442d15f 100644
--- a/spec/inputs/switch.yue
+++ b/spec/inputs/switch.yue
@@ -108,10 +108,20 @@ do
108 108
109do 109do
110 tb = {} 110 tb = {}
111
111 switch tb 112 switch tb
112 when {:a = 1, :b = 2} 113 when {:a = 1, :b = 2}
113 print a, b 114 print a, b
114 115
116 switch tb
117 when {:a, :b = 2}
118 print "partially matched", a, b
119
120 switch tb
121 when {:a, :b}
122 print a, b
123 else
124 print "not matched"
115do 125do
116 tb = x: "abc" 126 tb = x: "abc"
117 switch tb 127 switch tb
diff --git a/spec/outputs/switch.lua b/spec/outputs/switch.lua
index c4cde26..4358027 100644
--- a/spec/outputs/switch.lua
+++ b/spec/outputs/switch.lua
@@ -247,6 +247,34 @@ do
247 print(a, b) 247 print(a, b)
248 end 248 end
249 end 249 end
250 do
251 local _tab_0 = "table" == type(tb)
252 if _tab_0 then
253 local a = tb.a
254 local b = tb.b
255 if b == nil then
256 b = 2
257 end
258 if a ~= nil then
259 print("partially matched", a, b)
260 end
261 end
262 end
263 do
264 local _tab_0 = "table" == type(tb)
265 local _match_0 = false
266 if _tab_0 then
267 local a = tb.a
268 local b = tb.b
269 if a ~= nil and b ~= nil then
270 _match_0 = true
271 print(a, b)
272 end
273 end
274 if not _match_0 then
275 print("not matched")
276 end
277 end
250end 278end
251do 279do
252 local tb = { 280 local tb = {