Module:Template test case: Difference between revisions
(add the option defaults before we compress the table to fix the case where the first numbered argument is higher than 2) |
(Don't export the table and nowiki functions. At the moment the Lua interfaces don't make much sense, and rewriting the module to include nice Lua interfaces would probably be a lot of wasted work, as Lua modules will generally use Lua-based test cases.) |
||
Line 474: | Line 474: | ||
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
-- | -- Bridge functions | ||
-- | |||
-- These functions translate template arguments into forms that can be accepted | |||
-- by the different classes, and return the results. | |||
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
local | local bridge = {} | ||
function | function bridge.table(args, cfg) | ||
cfg = cfg or mw.loadData(DATA_MODULE) | cfg = cfg or mw.loadData(DATA_MODULE) | ||
Line 508: | Line 511: | ||
end | end | ||
function | function bridge.nowiki(args, cfg) | ||
cfg = cfg or mw.loadData(DATA_MODULE) | cfg = cfg or mw.loadData(DATA_MODULE) | ||
Line 518: | Line 521: | ||
return tostring(testCaseObj) | return tostring(testCaseObj) | ||
end | end | ||
------------------------------------------------------------------------------- | |||
-- Exports | |||
------------------------------------------------------------------------------- | |||
local p = {} | |||
function p.main(frame, cfg) | function p.main(frame, cfg) | ||
Line 552: | Line 561: | ||
end | end | ||
return | return bridge[func](args, cfg) | ||
end | end | ||