Content deleted Content added
Line 106:
===Testing in a sandboxed environment===
If the module under test is sandboxed, that is under [[Special:MyPage/sandbox]], then the debugger is not directly available and we must put the testing inside the module itself.
Sometimes it is better to put the wrapper in the module under inspection itself
<source lang="Lua">
local timing = require 'Module:Timing'
my_object = {};
my_object.hello = function( frame )
local str = "Hi there World!"
return str
end
my_object.TIMING = function (frame)
return timing(my_object.hello)
end
return my_object
</source>
This can them be used in [[Special:TemplateSandbox]] with a prefix from [[Special:MyPage/sandbox]] and any "render page" we see fit for the purpose. Often we want a specific page though to get access to additional data like the Wikidata item. Fill inn an invoke-call for our helper function
<source lang="html5">
{{#invoke|HelloWorld|TIMING}}
</source>
and we will have a timing report for the helper call in the module.
==Gadget==
|