Difference between revisions of "Template:Documentation/preload-module-testcases"

From blackwiki
Jump to navigation Jump to search
test>TheDJ
(template)
 
test>TheDJ
Line 1: Line 1:
-- For example unit tests, see [[Module:Bananas/tests]]
+
-- Example Unit tests for [[Module:Bananas]]. Click talk page to run tests.
local p = {}
+
local p = require('Module:UnitTests')
+
 
function p.hello()
+
function p:test_hello()
     return "Hello, world!"
+
     self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!')
 
end
 
end
+
 
 
return p
 
return p

Revision as of 12:13, 21 March 2013

-- Example Unit tests for Module:Bananas. Click talk page to run tests. local p = require('Module:UnitTests')

function p:test_hello()

   self:preprocess_equals('Script error: No such module "Bananas".', 'Hello, world!')

end

return p