aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/backcall.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/backcall.lua
parenta19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff)
downloadyuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip
fix test.
Diffstat (limited to 'spec/outputs/backcall.lua')
-rw-r--r--spec/outputs/backcall.lua130
1 files changed, 130 insertions, 0 deletions
diff --git a/spec/outputs/backcall.lua b/spec/outputs/backcall.lua
new file mode 100644
index 0000000..9f7ec29
--- /dev/null
+++ b/spec/outputs/backcall.lua
@@ -0,0 +1,130 @@
1do
2 map({
3 1,
4 2,
5 3
6 }, function(x)
7 return x * 2
8 end)
9end
10do
11 map(function(x)
12 return x * 2
13 end, {
14 1,
15 2,
16 3
17 })
18end
19do
20 filter(function(x)
21 return x > 2
22 end, (function()
23 return map(function(x)
24 return x * 2
25 end, {
26 1,
27 2,
28 3,
29 4
30 })
31 end)())
32end
33do
34 if http ~= nil then
35 http.get("ajaxtest", function(data)
36 body[".result"]:html(data)
37 return http.post("ajaxprocess", data, function(processed)
38 body[".result"]:append(processed)
39 return setTimeout(1000, function()
40 return print("done")
41 end)
42 end)
43 end)
44 end
45end
46do
47 syncStatus(function()
48 return loadAsync("file.yue", function(err, data)
49 if data == nil then
50 data = "nil"
51 end
52 if err then
53 print(err)
54 return
55 end
56 return compileAsync(data, function(codes)
57 local func = loadstring(codes)
58 return func()
59 end)
60 end)
61 end)
62end
63do
64 f1(function()
65 return f2(function()
66 do
67 f3(function()
68 return f4(function() end)
69 end)
70 end
71 return f5(function()
72 return f6(function()
73 return f7()
74 end)
75 end)
76 end)
77 end)
78end
79do
80 local result, msg
81 do
82 do
83 local _obj_0 = receiveAsync("filename.txt", function(data)
84 print(data)
85 return processAsync(data, function(info)
86 return check(info)
87 end)
88 end)
89 result, msg = _obj_0.result, _obj_0.msg
90 end
91 end
92 print(result, msg)
93 local totalSize = reduce(((function()
94 local _accum_0 = { }
95 local _len_0 = 1
96 local _list_0 = files
97 for _index_0 = 1, #_list_0 do
98 local file = _list_0[_index_0]
99 _accum_0[_len_0] = loadAsync(file, function(data)
100 return addToCache(file, data)
101 end)
102 _len_0 = _len_0 + 1
103 end
104 return _accum_0
105 end)()), 0, function(a, b)
106 return a + b
107 end)
108end
109local propA
110do
111 propA = property(function(self)
112 return self._value
113 end, function(self, value)
114 print("old value: " .. tostring(self._value))
115 print("new value: " .. tostring(value))
116 self._value = value
117 end)
118end
119local propB
120do
121 propB = property(function(self)
122 return self._value
123 end, function(self, value)
124 print("old value: " .. tostring(self._value))
125 print("new value: " .. tostring(value))
126 self._value = value
127 end)
128end
129alert("hi")
130return nil