Allows easier testing of template-invokable functions that take a frame
object as the only argument.
-- Equivalent to {{grc-IPA|ἁγιότης}}
require "Module:frame test".test_frame_function(require "Module:grc-pronunciation".create, {}, { "ἁγιότης" })
local export = {}
local parent_frame = {}
-- frame_args: table; parent_frame_args: table; title: string (full pagename)
function export.test_frame_function(func, frame_args, parent_frame_args, title)
parent_frame.args = parent_frame_args
local frame = { args = frame_args, getParent = function() return parent_frame end }
if title then
-- Not always reliable and maybe dangerous.
mw.title.getCurrentTitle = function ()
return mw.title.new(title)
end
end
return func(frame)
end
return export