line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# This file was autogenerated by inc/Marpa/R3/Lua/Test/More.PL |
3
|
|
|
|
|
|
|
# IF YOU EDIT THIS FILE, YOUR CHANGES WILL BE LOST |
4
|
|
|
|
|
|
|
# This is not a source file. For license information, |
5
|
|
|
|
|
|
|
# consult the source files. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Marpa::R3::Lua::Test::More; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
2238
|
use 5.010001; |
|
1
|
|
|
|
|
10
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
12
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
481
|
use Marpa::R3::Lua::Test::Builder; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION $STRING_VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
313
|
|
17
|
|
|
|
|
|
|
$VERSION = '4.001_024'; |
18
|
|
|
|
|
|
|
$STRING_VERSION = $VERSION; |
19
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$Marpa::R3::Lua::Test::More::loader = <<'END_OF_LUA'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
-- |
24
|
|
|
|
|
|
|
-- lua-TestMore : |
25
|
|
|
|
|
|
|
-- |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
local loadstring = loadstring or load |
28
|
|
|
|
|
|
|
local pairs = pairs |
29
|
|
|
|
|
|
|
local pcall = pcall |
30
|
|
|
|
|
|
|
local require = require |
31
|
|
|
|
|
|
|
local tostring = tostring |
32
|
|
|
|
|
|
|
local type = type |
33
|
|
|
|
|
|
|
local match = require 'string'.match |
34
|
|
|
|
|
|
|
local unpack = require 'table'.unpack or unpack |
35
|
|
|
|
|
|
|
local _G = _G |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
local tb = require 'Test.Builder'.new() |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
_ENV = nil |
40
|
|
|
|
|
|
|
local m = {} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
function m.plan (arg) |
43
|
|
|
|
|
|
|
tb:plan(arg) |
44
|
|
|
|
|
|
|
end |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
function m.done_testing (num_tests) |
47
|
|
|
|
|
|
|
tb:done_testing(num_tests) |
48
|
|
|
|
|
|
|
end |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
function m.skip_all (reason) |
51
|
|
|
|
|
|
|
tb:skip_all(reason) |
52
|
|
|
|
|
|
|
end |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
function m.BAIL_OUT (reason) |
55
|
|
|
|
|
|
|
tb:BAIL_OUT(reason) |
56
|
|
|
|
|
|
|
end |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
function m.ok (test, name) |
59
|
|
|
|
|
|
|
tb:ok(test, name) |
60
|
|
|
|
|
|
|
end |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
function m.nok (test, name) |
63
|
|
|
|
|
|
|
tb:ok(not test, name) |
64
|
|
|
|
|
|
|
end |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
function m.is (got, expected, name) |
67
|
|
|
|
|
|
|
local pass = got == expected |
68
|
|
|
|
|
|
|
tb:ok(pass, name) |
69
|
|
|
|
|
|
|
if not pass then |
70
|
|
|
|
|
|
|
tb:diag(" got: " .. tostring(got) |
71
|
|
|
|
|
|
|
.. "\n expected: " .. tostring(expected)) |
72
|
|
|
|
|
|
|
end |
73
|
|
|
|
|
|
|
end |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
function m.isnt (got, expected, name) |
76
|
|
|
|
|
|
|
local pass = got ~= expected |
77
|
|
|
|
|
|
|
tb:ok(pass, name) |
78
|
|
|
|
|
|
|
if not pass then |
79
|
|
|
|
|
|
|
tb:diag(" got: " .. tostring(got) |
80
|
|
|
|
|
|
|
.. "\n expected: anything else") |
81
|
|
|
|
|
|
|
end |
82
|
|
|
|
|
|
|
end |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
function m.like (got, pattern, name) |
85
|
|
|
|
|
|
|
if type(pattern) ~= 'string' then |
86
|
|
|
|
|
|
|
tb:ok(false, name) |
87
|
|
|
|
|
|
|
tb:diag("pattern isn't a string : " .. tostring(pattern)) |
88
|
|
|
|
|
|
|
return |
89
|
|
|
|
|
|
|
end |
90
|
|
|
|
|
|
|
got = tostring(got) |
91
|
|
|
|
|
|
|
local pass = match(got, pattern) |
92
|
|
|
|
|
|
|
tb:ok(pass, name) |
93
|
|
|
|
|
|
|
if not pass then |
94
|
|
|
|
|
|
|
tb:diag(" '" .. got .. "'" |
95
|
|
|
|
|
|
|
.. "\n doesn't match '" .. pattern .. "'") |
96
|
|
|
|
|
|
|
end |
97
|
|
|
|
|
|
|
end |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
function m.unlike (got, pattern, name) |
100
|
|
|
|
|
|
|
if type(pattern) ~= 'string' then |
101
|
|
|
|
|
|
|
tb:ok(false, name) |
102
|
|
|
|
|
|
|
tb:diag("pattern isn't a string : " .. tostring(pattern)) |
103
|
|
|
|
|
|
|
return |
104
|
|
|
|
|
|
|
end |
105
|
|
|
|
|
|
|
got = tostring(got) |
106
|
|
|
|
|
|
|
local pass = not match(got, pattern) |
107
|
|
|
|
|
|
|
tb:ok(pass, name) |
108
|
|
|
|
|
|
|
if not pass then |
109
|
|
|
|
|
|
|
tb:diag(" '" .. got .. "'" |
110
|
|
|
|
|
|
|
.. "\n matches '" .. pattern .. "'") |
111
|
|
|
|
|
|
|
end |
112
|
|
|
|
|
|
|
end |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
local cmp = { |
115
|
|
|
|
|
|
|
['<'] = function (a, b) return a < b end, |
116
|
|
|
|
|
|
|
['<='] = function (a, b) return a <= b end, |
117
|
|
|
|
|
|
|
['>'] = function (a, b) return a > b end, |
118
|
|
|
|
|
|
|
['>='] = function (a, b) return a >= b end, |
119
|
|
|
|
|
|
|
['=='] = function (a, b) return a == b end, |
120
|
|
|
|
|
|
|
['~='] = function (a, b) return a ~= b end, |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
function m.cmp_ok (this, op, that, name) |
124
|
|
|
|
|
|
|
local f = cmp[op] |
125
|
|
|
|
|
|
|
if not f then |
126
|
|
|
|
|
|
|
tb:ok(false, name) |
127
|
|
|
|
|
|
|
tb:diag("unknown operator : " .. tostring(op)) |
128
|
|
|
|
|
|
|
return |
129
|
|
|
|
|
|
|
end |
130
|
|
|
|
|
|
|
local pass = f(this, that) |
131
|
|
|
|
|
|
|
tb:ok(pass, name) |
132
|
|
|
|
|
|
|
if not pass then |
133
|
|
|
|
|
|
|
tb:diag(" " .. tostring(this) |
134
|
|
|
|
|
|
|
.. "\n " .. op |
135
|
|
|
|
|
|
|
.. "\n " .. tostring(that)) |
136
|
|
|
|
|
|
|
end |
137
|
|
|
|
|
|
|
end |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
function m.type_ok (val, t, name) |
140
|
|
|
|
|
|
|
if type(t) ~= 'string' then |
141
|
|
|
|
|
|
|
tb:ok(false, name) |
142
|
|
|
|
|
|
|
tb:diag("type isn't a string : " .. tostring(t)) |
143
|
|
|
|
|
|
|
return |
144
|
|
|
|
|
|
|
end |
145
|
|
|
|
|
|
|
if type(val) == t then |
146
|
|
|
|
|
|
|
tb:ok(true, name) |
147
|
|
|
|
|
|
|
else |
148
|
|
|
|
|
|
|
tb:ok(false, name) |
149
|
|
|
|
|
|
|
tb:diag(" " .. tostring(val) .. " isn't a '" .. t .."' it's a '" .. type(val) .. "'") |
150
|
|
|
|
|
|
|
end |
151
|
|
|
|
|
|
|
end |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
function m.subtest (name, func) |
154
|
|
|
|
|
|
|
tb:subtest(name, func) |
155
|
|
|
|
|
|
|
end |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
function m.pass (name) |
158
|
|
|
|
|
|
|
tb:ok(true, name) |
159
|
|
|
|
|
|
|
end |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
function m.fail (name) |
162
|
|
|
|
|
|
|
tb:ok(false, name) |
163
|
|
|
|
|
|
|
end |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
function m.require_ok (mod) |
166
|
|
|
|
|
|
|
local r, msg = pcall(require, mod) |
167
|
|
|
|
|
|
|
tb:ok(r, "require '" .. tostring(mod) .. "'") |
168
|
|
|
|
|
|
|
if not r then |
169
|
|
|
|
|
|
|
tb:diag(" " .. msg) |
170
|
|
|
|
|
|
|
end |
171
|
|
|
|
|
|
|
return r |
172
|
|
|
|
|
|
|
end |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
function m.eq_array (got, expected, name) |
175
|
|
|
|
|
|
|
if type(got) ~= 'table' then |
176
|
|
|
|
|
|
|
tb:ok(false, name) |
177
|
|
|
|
|
|
|
tb:diag("got value isn't a table : " .. tostring(got)) |
178
|
|
|
|
|
|
|
return |
179
|
|
|
|
|
|
|
elseif type(expected) ~= 'table' then |
180
|
|
|
|
|
|
|
tb:ok(false, name) |
181
|
|
|
|
|
|
|
tb:diag("expected value isn't a table : " .. tostring(expected)) |
182
|
|
|
|
|
|
|
return |
183
|
|
|
|
|
|
|
end |
184
|
|
|
|
|
|
|
for i = 1, #expected do |
185
|
|
|
|
|
|
|
local v = expected[i] |
186
|
|
|
|
|
|
|
local val = got[i] |
187
|
|
|
|
|
|
|
if val ~= v then |
188
|
|
|
|
|
|
|
tb:ok(false, name) |
189
|
|
|
|
|
|
|
tb:diag(" at index: " .. tostring(i) |
190
|
|
|
|
|
|
|
.. "\n got: " .. tostring(val) |
191
|
|
|
|
|
|
|
.. "\n expected: " .. tostring(v)) |
192
|
|
|
|
|
|
|
return |
193
|
|
|
|
|
|
|
end |
194
|
|
|
|
|
|
|
end |
195
|
|
|
|
|
|
|
local extra = #got - #expected |
196
|
|
|
|
|
|
|
if extra ~= 0 then |
197
|
|
|
|
|
|
|
tb:ok(false, name) |
198
|
|
|
|
|
|
|
tb:diag(" " .. tostring(extra) .. " unexpected item(s)") |
199
|
|
|
|
|
|
|
else |
200
|
|
|
|
|
|
|
tb:ok(true, name) |
201
|
|
|
|
|
|
|
end |
202
|
|
|
|
|
|
|
end |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
function m.is_deeply (got, expected, name) |
205
|
|
|
|
|
|
|
if type(got) ~= 'table' then |
206
|
|
|
|
|
|
|
tb:ok(false, name) |
207
|
|
|
|
|
|
|
tb:diag("got value isn't a table : " .. tostring(got)) |
208
|
|
|
|
|
|
|
return |
209
|
|
|
|
|
|
|
elseif type(expected) ~= 'table' then |
210
|
|
|
|
|
|
|
tb:ok(false, name) |
211
|
|
|
|
|
|
|
tb:diag("expected value isn't a table : " .. tostring(expected)) |
212
|
|
|
|
|
|
|
return |
213
|
|
|
|
|
|
|
end |
214
|
|
|
|
|
|
|
local msg1 |
215
|
|
|
|
|
|
|
local msg2 |
216
|
|
|
|
|
|
|
local seen = {} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
local function deep_eq (t1, t2, key_path) |
219
|
|
|
|
|
|
|
if t1 == t2 or seen[t1] then |
220
|
|
|
|
|
|
|
return true |
221
|
|
|
|
|
|
|
end |
222
|
|
|
|
|
|
|
seen[t1] = true |
223
|
|
|
|
|
|
|
for k, v2 in pairs(t2) do |
224
|
|
|
|
|
|
|
local v1 = t1[k] |
225
|
|
|
|
|
|
|
if type(v1) == 'table' and type(v2) == 'table' then |
226
|
|
|
|
|
|
|
local r = deep_eq(v1, v2, key_path .. "." .. tostring(k)) |
227
|
|
|
|
|
|
|
if not r then |
228
|
|
|
|
|
|
|
return false |
229
|
|
|
|
|
|
|
end |
230
|
|
|
|
|
|
|
else |
231
|
|
|
|
|
|
|
if v1 ~= v2 then |
232
|
|
|
|
|
|
|
key_path = key_path .. "." .. tostring(k) |
233
|
|
|
|
|
|
|
msg1 = " got" .. key_path .. ": " .. tostring(v1) |
234
|
|
|
|
|
|
|
msg2 = "expected" .. key_path .. ": " .. tostring(v2) |
235
|
|
|
|
|
|
|
return false |
236
|
|
|
|
|
|
|
end |
237
|
|
|
|
|
|
|
end |
238
|
|
|
|
|
|
|
end |
239
|
|
|
|
|
|
|
for k in pairs(t1) do |
240
|
|
|
|
|
|
|
local v2 = t2[k] |
241
|
|
|
|
|
|
|
if v2 == nil then |
242
|
|
|
|
|
|
|
key_path = key_path .. "." .. tostring(k) |
243
|
|
|
|
|
|
|
msg1 = " got" .. key_path .. ": " .. tostring(t1[k]) |
244
|
|
|
|
|
|
|
msg2 = "expected" .. key_path .. ": " .. tostring(v2) |
245
|
|
|
|
|
|
|
return false |
246
|
|
|
|
|
|
|
end |
247
|
|
|
|
|
|
|
end |
248
|
|
|
|
|
|
|
return true |
249
|
|
|
|
|
|
|
end -- deep_eq |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
local pass = deep_eq(got, expected, '') |
252
|
|
|
|
|
|
|
tb:ok(pass, name) |
253
|
|
|
|
|
|
|
if not pass then |
254
|
|
|
|
|
|
|
tb:diag(" Tables begin differing at:") |
255
|
|
|
|
|
|
|
tb:diag(" " .. msg1) |
256
|
|
|
|
|
|
|
tb:diag(" " .. msg2) |
257
|
|
|
|
|
|
|
end |
258
|
|
|
|
|
|
|
end |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
local function compile(code, name) |
261
|
|
|
|
|
|
|
local msg |
262
|
|
|
|
|
|
|
code, msg = loadstring(code) |
263
|
|
|
|
|
|
|
if not code then |
264
|
|
|
|
|
|
|
tb:ok(false, name, 1) |
265
|
|
|
|
|
|
|
tb:diag(" can't compile code :" |
266
|
|
|
|
|
|
|
.. "\n " .. msg) |
267
|
|
|
|
|
|
|
end |
268
|
|
|
|
|
|
|
return code |
269
|
|
|
|
|
|
|
end |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
function m.error_is (code, arg2, arg3, arg4) |
272
|
|
|
|
|
|
|
local params, expected, name |
273
|
|
|
|
|
|
|
if type(arg2) == 'table' then |
274
|
|
|
|
|
|
|
params = arg2 |
275
|
|
|
|
|
|
|
expected = arg3 |
276
|
|
|
|
|
|
|
name = arg4 |
277
|
|
|
|
|
|
|
else |
278
|
|
|
|
|
|
|
params = {} |
279
|
|
|
|
|
|
|
expected = arg2 |
280
|
|
|
|
|
|
|
name = arg3 |
281
|
|
|
|
|
|
|
end |
282
|
|
|
|
|
|
|
if type(code) == 'string' then |
283
|
|
|
|
|
|
|
code = compile(code, name) |
284
|
|
|
|
|
|
|
if not code then |
285
|
|
|
|
|
|
|
return |
286
|
|
|
|
|
|
|
end |
287
|
|
|
|
|
|
|
end |
288
|
|
|
|
|
|
|
local r, msg = pcall(code, unpack(params)) |
289
|
|
|
|
|
|
|
if r then |
290
|
|
|
|
|
|
|
tb:ok(false, name) |
291
|
|
|
|
|
|
|
tb:diag(" unexpected success" |
292
|
|
|
|
|
|
|
.. "\n expected: " .. tostring(expected)) |
293
|
|
|
|
|
|
|
else |
294
|
|
|
|
|
|
|
msg = tostring(msg) |
295
|
|
|
|
|
|
|
expected = tostring(expected) |
296
|
|
|
|
|
|
|
local pass = msg == expected |
297
|
|
|
|
|
|
|
tb:ok(pass, name) |
298
|
|
|
|
|
|
|
if not pass then |
299
|
|
|
|
|
|
|
tb:diag(" got: " .. msg |
300
|
|
|
|
|
|
|
.. "\n expected: " .. expected) |
301
|
|
|
|
|
|
|
end |
302
|
|
|
|
|
|
|
end |
303
|
|
|
|
|
|
|
end |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
function m.error_like (code, arg2, arg3, arg4) |
306
|
|
|
|
|
|
|
local params, pattern, name |
307
|
|
|
|
|
|
|
if type(arg2) == 'table' then |
308
|
|
|
|
|
|
|
params = arg2 |
309
|
|
|
|
|
|
|
pattern = arg3 |
310
|
|
|
|
|
|
|
name = arg4 |
311
|
|
|
|
|
|
|
else |
312
|
|
|
|
|
|
|
params = {} |
313
|
|
|
|
|
|
|
pattern = arg2 |
314
|
|
|
|
|
|
|
name = arg3 |
315
|
|
|
|
|
|
|
end |
316
|
|
|
|
|
|
|
if type(code) == 'string' then |
317
|
|
|
|
|
|
|
code = compile(code, name) |
318
|
|
|
|
|
|
|
if not code then |
319
|
|
|
|
|
|
|
return |
320
|
|
|
|
|
|
|
end |
321
|
|
|
|
|
|
|
end |
322
|
|
|
|
|
|
|
local r, msg = pcall(code, unpack(params)) |
323
|
|
|
|
|
|
|
if r then |
324
|
|
|
|
|
|
|
tb:ok(false, name) |
325
|
|
|
|
|
|
|
tb:diag(" unexpected success" |
326
|
|
|
|
|
|
|
.. "\n expected: " .. tostring(pattern)) |
327
|
|
|
|
|
|
|
else |
328
|
|
|
|
|
|
|
if type(pattern) ~= 'string' then |
329
|
|
|
|
|
|
|
tb:ok(false, name) |
330
|
|
|
|
|
|
|
tb:diag("pattern isn't a string : " .. tostring(pattern)) |
331
|
|
|
|
|
|
|
return |
332
|
|
|
|
|
|
|
end |
333
|
|
|
|
|
|
|
msg = tostring(msg) |
334
|
|
|
|
|
|
|
local pass = match(msg, pattern) |
335
|
|
|
|
|
|
|
tb:ok(pass, name) |
336
|
|
|
|
|
|
|
if not pass then |
337
|
|
|
|
|
|
|
tb:diag(" '" .. msg .. "'" |
338
|
|
|
|
|
|
|
.. "\n doesn't match '" .. pattern .. "'") |
339
|
|
|
|
|
|
|
end |
340
|
|
|
|
|
|
|
end |
341
|
|
|
|
|
|
|
end |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
function m.lives_ok (code, arg2, arg3) |
344
|
|
|
|
|
|
|
local params, name |
345
|
|
|
|
|
|
|
if type(arg2) == 'table' then |
346
|
|
|
|
|
|
|
params = arg2 |
347
|
|
|
|
|
|
|
name = arg3 |
348
|
|
|
|
|
|
|
else |
349
|
|
|
|
|
|
|
params = {} |
350
|
|
|
|
|
|
|
name = arg2 |
351
|
|
|
|
|
|
|
end |
352
|
|
|
|
|
|
|
if type(code) == 'string' then |
353
|
|
|
|
|
|
|
code = compile(code, name) |
354
|
|
|
|
|
|
|
if not code then |
355
|
|
|
|
|
|
|
return |
356
|
|
|
|
|
|
|
end |
357
|
|
|
|
|
|
|
end |
358
|
|
|
|
|
|
|
local r, msg = pcall(code, unpack(params)) |
359
|
|
|
|
|
|
|
tb:ok(r, name) |
360
|
|
|
|
|
|
|
if not r then |
361
|
|
|
|
|
|
|
tb:diag(" " .. msg) |
362
|
|
|
|
|
|
|
end |
363
|
|
|
|
|
|
|
end |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
function m.diag (msg) |
366
|
|
|
|
|
|
|
tb:diag(msg) |
367
|
|
|
|
|
|
|
end |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
function m.note (msg) |
370
|
|
|
|
|
|
|
tb:note(msg) |
371
|
|
|
|
|
|
|
end |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
function m.skip (reason, count) |
374
|
|
|
|
|
|
|
count = count or 1 |
375
|
|
|
|
|
|
|
for _ = 1, count do |
376
|
|
|
|
|
|
|
tb:skip(reason) |
377
|
|
|
|
|
|
|
end |
378
|
|
|
|
|
|
|
end |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
function m.todo_skip (reason, count) |
381
|
|
|
|
|
|
|
count = count or 1 |
382
|
|
|
|
|
|
|
for _ = 1, count do |
383
|
|
|
|
|
|
|
tb:todo_skip(reason) |
384
|
|
|
|
|
|
|
end |
385
|
|
|
|
|
|
|
end |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
function m.skip_rest (reason) |
388
|
|
|
|
|
|
|
tb:skip_rest(reason) |
389
|
|
|
|
|
|
|
end |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
function m.todo (reason, count) |
392
|
|
|
|
|
|
|
tb:todo(reason, count) |
393
|
|
|
|
|
|
|
end |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
for k, v in pairs(m) do -- injection |
396
|
|
|
|
|
|
|
_G[k] = v |
397
|
|
|
|
|
|
|
end |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
m._VERSION = "0.3.2" |
400
|
|
|
|
|
|
|
m._DESCRIPTION = "lua-TestMore : an Unit Testing Framework" |
401
|
|
|
|
|
|
|
m._COPYRIGHT = "Copyright (c) 2009-2015 Francois Perrad" |
402
|
|
|
|
|
|
|
return m |
403
|
|
|
|
|
|
|
-- |
404
|
|
|
|
|
|
|
-- This library is licensed under the terms of the MIT/X11 license, |
405
|
|
|
|
|
|
|
-- like Lua itself. |
406
|
|
|
|
|
|
|
-- |
407
|
|
|
|
|
|
|
END_OF_LUA |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
sub load_me |
410
|
|
|
|
|
|
|
{ |
411
|
1
|
|
|
1
|
0
|
2502
|
my ($lua_interp) = @_; |
412
|
1
|
|
|
|
|
2
|
state $script = <<'END_OF_LUA'; |
413
|
|
|
|
|
|
|
local raw_test_builder_loader, raw_test_more_loader = ... |
414
|
|
|
|
|
|
|
local test_builder_loader = tostring(raw_test_builder_loader) |
415
|
|
|
|
|
|
|
local test_more_loader = tostring(raw_test_more_loader) |
416
|
|
|
|
|
|
|
if not Test then Test = {} end |
417
|
|
|
|
|
|
|
local load_fn = load(test_builder_loader) |
418
|
|
|
|
|
|
|
Test.Builder = load_fn() |
419
|
|
|
|
|
|
|
package.loaded['Test.Builder'] = Test.Builder |
420
|
|
|
|
|
|
|
load_fn = load(test_more_loader) |
421
|
|
|
|
|
|
|
Test.More = load_fn() |
422
|
|
|
|
|
|
|
package.loaded['Test.More'] = Test.More |
423
|
|
|
|
|
|
|
END_OF_LUA |
424
|
1
|
|
|
|
|
1069
|
$lua_interp->call_by_tag(-1, |
425
|
|
|
|
|
|
|
( '@' . __FILE__ . ':' . __LINE__ ), |
426
|
|
|
|
|
|
|
$script, 'SS', |
427
|
|
|
|
|
|
|
$Marpa::R3::Lua::Test::Builder::loader, |
428
|
|
|
|
|
|
|
$Marpa::R3::Lua::Test::More::loader) |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
1; |