summaryrefslogtreecommitdiff
path: root/server/test/vm/normal.lua
blob: 02b1f4f014a0fd8ae1325fed58d002577d8c6bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
TEST [[
do
    x = 1
end
]]

TEST [[
return nil, 1, true, 'xx'
]]

TEST [[
return a
]]

TEST [[
retrun a.b:c(1, 2, ...)[1][name]
]]

TEST [[
return 1 + 1
]]

TEST [[
return -1
]]

TEST [[
return ...
]]

TEST [[
return function (a, b, ...)
end
]]

TEST [[
return {
    a = 1,
    b = {
        c = d,
        e = f,
    },
    g,
    h,
    1,
}
]]

TEST [[
::LABEL::
goto LABEL
goto NEXT
::NEXT::
]]

TEST [[
a, b, c = 1, 2, ...
]]

TEST [[
local a, b, c = 1, 2, ...
]]

TEST [[
a[#a+1] = 1
]]

TEST [[
xx(a, b, 2, 3, ...)
]]

TEST [[
if a then
elseif b then
elseif c then
else
end
]]

TEST [[
for i = 1, 10, 1 do
end
]]

TEST [[
for a, b, c in pairs(t) do
end
]]

TEST [[
while true do
end
]]

TEST [[
repeat
until true
]]

TEST [[
function xx:yy(a, b, c, ...)
end
]]

TEST [[
local function xx(a, b, c, ...)
end
]]

TEST [[
local v = 1
local function xx()
    print(v)
end
local v = 2
xx()
]]

TEST [[
return {
    1, 2, 3
}
]]

TEST [[
return function ()
end
]]