Jump to content

Modulo:Angkla/pangsubok

Manipud iti Wikipedia, ti nawaya nga ensiklopedia
-- Panagsubok para iti [[Modulo:Angkla]]. Pinduten ti tungtunganna a panid tapno maipataray ti panagsubok.

local anchor = require('Modulo:Angkla') -- the module to be tested
local ScribuntoUnit = require('Modulo:ScribuntoUnit')
local suite = ScribuntoUnit:new()

function suite:testmain()
	self:assertResultEquals('<span class="anchor" id="foo"></span>', '{{#invoke:Angkla|main|foo}}')
	self:assertResultEquals('<span class="anchor" id="foo"></span><span class="anchor" id="bar"></span>', '{{#invoke:Angkla|main|foo|bar}}')
	self:assertResultEquals('<span class="anchor" id="foo"></span>', '{{#invoke:Angkla|main|3=foo}}')
	self:assertResultEquals('<span class="anchor" id="foo"></span>', '{{#invoke:Angkla|main|  foo  }}')
	self:assertResultEquals('<span class="anchor" id="foo"></span>', '{{#invoke:Angkla|main|25=foo}}')
end

function suite:test_main()
	self:assertResultEquals('<span class="anchor" id="foo"></span>', anchor._main('foo'))
	self:assertResultEquals('<span class="anchor" id="foo"></span><span class="anchor" id="bar"></span>', anchor._main('foo', 'bar'))
end

function suite:testAgainstTemplate()
	self:assertSameResult('{{angkla|foo}}', '{{#invoke:Angkla|main|foo}}')
	self:assertSameResult('{{angkla|foo|bar}}', '{{#invoke:Angkla|main|foo|bar}}')
	self:assertSameResult('{{angkla|3=foo}}', '{{#invoke:Angkla|main|3=foo}}')
end

return suite