Mòdul:DemoArgs/tests

De la Viquipèdia, l'enciclopèdia lliure
-- Unitat de tests per a [[Mòdul:DemoArgs]]. Està executat a la pàgina de discussió.
local p = require('Mòdul:UnitTests')
 
function p:test_hola_tots()
    self:preprocess_equals('{{#invoke:DemoArgs|hola_tots}}', 'Hola, món!')
end
 
function p:test_hola()
    self:preprocess_equals('{{#invoke:DemoArgs|hola|Cesc}}', 'Hola, Cesc!')
end
 
function p:test_suma()
    self:preprocess_equals('{{#invoke:DemoArgs|suma|5|3}}', '8')
end
 
function p:test_tinc_fruita()
    self:preprocess_equals('{{#invoke:DemoArgs|tinc_fruita|pomes=5|peres=3}}', 'Tinc 5 pomes i 3 peres')
end

function p:test_tens_fruita()
    self:preprocess_equals('{{#invoke:DemoArgs|tens_fruita|Cesc|bananas=5|cireres=7}}', 'Cesc té: 5 bananas 7 cireres')
end
 
function p:test_escarrega_fruita()
    self:preprocess_equals('{{#invoke:DemoArgs|encarrega_fruita|pinyes=10|kiwis=5}}', 'Tinc: 10 pinyes 5 kiwis')
end
 
function p:test_encarrega_fruita_2()
    self:preprocess_equals('{{#invoke:DemoArgs|encarrega_fruita_2|Cesc|pinyes=10|kiwis=5}}', 'Cesc té: 10 pinyes 5 kiwis')
end

return p