aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-08-16 10:40:36 +0800
committerLi Jin <dragon-fly@qq.com>2022-08-16 10:40:36 +0800
commit82b86397797ecd4d1782ee75abf7933e5d973e3c (patch)
tree528cbf8a128c94679b63223e6fd16fa8659dbe36 /spec
parentbe7fabeef0b6de9b15c2ff34e95794d87042c3bd (diff)
downloadyuescript-82b86397797ecd4d1782ee75abf7933e5d973e3c.tar.gz
yuescript-82b86397797ecd4d1782ee75abf7933e5d973e3c.tar.bz2
yuescript-82b86397797ecd4d1782ee75abf7933e5d973e3c.zip
fix a missing argument number check.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/backcall.yue32
-rw-r--r--spec/outputs/backcall.lua16
2 files changed, 36 insertions, 12 deletions
diff --git a/spec/inputs/backcall.yue b/spec/inputs/backcall.yue
index d7ed0dd..8aadc71 100644
--- a/spec/inputs/backcall.yue
+++ b/spec/inputs/backcall.yue
@@ -1,32 +1,32 @@
1do 1do
2 (x)<- map {1,2,3} 2 (x) <- map {1,2,3}
3 x * 2 3 x * 2
4 4
5do 5do
6 (x)<- map _,{1,2,3} 6 (x) <- map _,{1,2,3}
7 x * 2 7 x * 2
8 8
9do 9do
10 (x)<- filter _, do 10 (x) <- filter _, do
11 (x)<- map _,{1,2,3,4} 11 (x) <- map _,{1,2,3,4}
12 x * 2 12 x * 2
13 x > 2 13 x > 2
14 14
15do 15do
16 (data)<- http?.get "ajaxtest" 16 (data) <- http?.get "ajaxtest"
17 body[".result"]\html data 17 body[".result"]\html data
18 (processed)<- http.post "ajaxprocess", data 18 (processed) <- http.post "ajaxprocess", data
19 body[".result"]\append processed 19 body[".result"]\append processed
20 <- setTimeout 1000 20 <- setTimeout 1000
21 print "done" 21 print "done"
22 22
23do 23do
24 <- syncStatus 24 <- syncStatus
25 (err, data="nil")<- loadAsync "file.yue" 25 (err, data="nil") <- loadAsync "file.yue"
26 if err 26 if err
27 print err 27 print err
28 return 28 return
29 (codes)<- compileAsync data 29 (codes) <- compileAsync data
30 func = loadstring codes 30 func = loadstring codes
31 func! 31 func!
32 32
@@ -42,18 +42,18 @@ do
42 42
43do 43do
44 :result,:msg = do 44 :result,:msg = do
45 (data)<- receiveAsync "filename.txt" 45 (data) <- receiveAsync "filename.txt"
46 print data 46 print data
47 (info)<- processAsync data 47 (info) <- processAsync data
48 check info 48 check info
49 print result,msg 49 print result,msg
50 50
51 totalSize = (for file in *files 51 totalSize = (for file in *files
52 (data)<- loadAsync file 52 (data) <- loadAsync file
53 addToCache file,data) |> reduce 0,(a,b)-> a+b 53 addToCache file,data) |> reduce 0,(a,b)-> a+b
54 54
55propA = do 55propA = do
56 (value)<= property => @_value 56 (value) <= property => @_value
57 print "old value: #{@_value}" 57 print "old value: #{@_value}"
58 print "new value: #{value}" 58 print "new value: #{value}"
59 @_value = value 59 @_value = value
@@ -67,5 +67,13 @@ propB = do
67 67
68alert "hi" 68alert "hi"
69 69
70local x, y, z
71x = do (a) < -b
72x, y, z = do (a) <- b
73x, y, z = do (a) <-b
74
75x = do a <= b
76x, y, z = do (a) <= b
77
70nil 78nil
71 79
diff --git a/spec/outputs/backcall.lua b/spec/outputs/backcall.lua
index 3a4c5e9..b065388 100644
--- a/spec/outputs/backcall.lua
+++ b/spec/outputs/backcall.lua
@@ -130,4 +130,20 @@ do
130 end) 130 end)
131end 131end
132alert("hi") 132alert("hi")
133local x, y, z
134do
135 x = (a) < -b
136end
137do
138 x, y, z = b(function(a) end)
139end
140do
141 x, y, z = b(function(a) end)
142end
143do
144 x = a <= b
145end
146do
147 x, y, z = b(function(self, a) end)
148end
133return nil 149return nil