Jump to content

Module:Example/testcases

From Simple English Wikipedia, the free encyclopedia
Revision as of 01:49, 4 November 2021 by MeritedElm63160 (talk | changes) (Created page with "-- Unit tests for Module:Example. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_equals('{{#invoke:Example | hello}}', 'Hello World!') end function p:test_hello_to() self:preprocess_equals('{{#invoke:Example|hello_to|Fred}}', 'Hello, Fred!') end function p:test_count_fruit() self:preprocess_equals('{{#invoke:Example|count_fruit|bananas=5|apples=3}}', 'I have 5 bananas and 3 apples') end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Example/testcases/doc

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

function p:test_hello()
    self:preprocess_equals('{{#invoke:Example | hello}}', 'Hello World!')
end

function p:test_hello_to()
    self:preprocess_equals('{{#invoke:Example|hello_to|Fred}}', 'Hello, Fred!')
end

function p:test_count_fruit()
    self:preprocess_equals('{{#invoke:Example|count_fruit|bananas=5|apples=3}}', 'I have 5 bananas and 3 apples')
end
return p