aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/pipe.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/pipe.lua
parenta19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff)
downloadyuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip
fix test.
Diffstat (limited to 'spec/outputs/pipe.lua')
-rw-r--r--spec/outputs/pipe.lua116
1 files changed, 116 insertions, 0 deletions
diff --git a/spec/outputs/pipe.lua b/spec/outputs/pipe.lua
new file mode 100644
index 0000000..bf517ae
--- /dev/null
+++ b/spec/outputs/pipe.lua
@@ -0,0 +1,116 @@
1foreach({
2 "abc",
3 123,
4 998
5}, print)
6print(reduce(filter(map({
7 1,
8 2,
9 3
10}, function(x)
11 return x * 2
12end), function(x)
13 return x > 4
14end), 0, function(a, b)
15 return a + b
16end))
17print(table.concat((function()
18 local _accum_0 = { }
19 local _len_0 = 1
20 for i = 0, 10 do
21 _accum_0[_len_0] = tostring(i)
22 _len_0 = _len_0 + 1
23 end
24 return _accum_0
25end)(), ","))
26local b = 1 + 2 + (print(tostring(4), 1) or 123)
27do
28 local x = math.max(233, 998)
29 if x then
30 print(x)
31 end
32end
33do
34 local _with_0
35 if create ~= nil then
36 _with_0 = create(b, "new")
37 end
38 _with_0.value = 123
39 print(_with_0:work())
40end
41if f ~= nil then
42 f(123)
43end
44if f2 ~= nil then
45 f2((function()
46 if f1 ~= nil then
47 return f1("abc")
48 end
49 return nil
50 end)())
51end
52local c
53if f2 ~= nil then
54 c = f2((function()
55 if f1 ~= nil then
56 return f1("abc")
57 end
58 return nil
59 end)())
60end
61local f
62f = function()
63 local _obj_0 = x.y
64 if _obj_0 ~= nil then
65 return _obj_0["if"](_obj_0, arg)
66 end
67 return nil
68end
69func2(998, "abc", func1(func0(233)))
70func2(func1(func0(998, "abc", 233)))
71f(1, 2, 3, 4, 5)
72f(1, val(2), 3, 4, 5)
73f(1, 2, arr[3], 4, 5)
74local a = f2(1, f1(1, 2, 3, tonumber(table.concat({
75 "1",
76 "2",
77 "3"
78}, ""))), 3)
79print(render(emit(parse(extract(readFile("example.txt"), language, { }), language))))
80print(render(emit(parse(extract(readFile("example.txt"), language, { }), language))))
81print(render(emit(parse(extract(readFile("example.txt"), language, { }), language))))
82f(not func(123))
83do
84 local _1 = abc(123, -func(list({
85 "abc",
86 "xyz",
87 "123"
88 }):map("#"):value()), "x")
89 _2, _3, _4 = 1, 2, f(3)
90 local _5
91 _5 = f4(f3(f2(f1(v, 1), 2), 3), 4)
92end
93local x = b(a(123)) or d(c(456)) or (function()
94 local _call_0 = a["if"]
95 return _call_0["then"](_call_0, "abc")
96end)() or (function()
97 if a ~= nil then
98 local _obj_0 = a.b
99 local _obj_1 = _obj_0.c
100 if _obj_1 ~= nil then
101 return _obj_1(_obj_0, 123)
102 end
103 return nil
104 end
105 return nil
106end)() or (function()
107 local _base_0 = x
108 local _fn_0 = _base_0.y
109 return _fn_0 and function(...)
110 return _fn_0(_base_0, ...)
111 end
112end)()
113local x1 = 3 * f(-4)
114local x2 = 3 * f(-2 ^ 2)
115local y = 1 + b(3, (a ^ c)(not #2)) * f1(f(4 ^ -123)) or 123
116return nil