local p = {}
local live = require('Module:Road data/locations')
local sandbox = require('Module:Road data/locations/sandbox')
local function showArgs(frame, args)
local out = ''
for _, arg in ipairs(args) do
out = out .. frame:preprocess('<syntaxhighlight lang="lua">' .. mw.dumpObject(arg) .. '</syntaxhighlight>')
end
return out
end
local function addTest(frame, out, functionName, ...)
out = out .. '|-\n'
out = out .. '| style="vertical-align:top" | <code>' .. functionName .. '</code> with arguments:' .. showArgs(frame, arg) .. '\n'
out = out .. frame:preprocess('| style="vertical-align:top" | <syntaxhighlight lang="lua">' .. mw.dumpObject(live[functionName](unpack(arg))) .. '</syntaxhighlight>\n')
out = out .. frame:preprocess('| style="vertical-align:top" | <syntaxhighlight lang="lua">' .. mw.dumpObject(sandbox[functionName](unpack(arg))) .. '</syntaxhighlight>\n')
return out
end
function p.test(frame)
local out = '{| class="wikitable"\n'
out = out .. '! Lua\n'
out = out .. '! Live\n'
out = out .. '! Sandbox\n'
out = addTest(
frame,
out,
'locations',
{
primary_topic = 'no',
country = 'USA',
region = 'New Jersey',
sub1 = 'Monmouth',
sub2 = 'Wall Township'
},
'jctint'
)
out = addTest(
frame,
out,
'locations',
{
primary_topic = 'no',
country = 'USA',
region = 'New Jersey',
sub1 = 'Monmouth',
sub2 = 'Wall Township'
},
'jcttop'
)
return out .. '|}\n'
end
return p