Jump to content

Module:qualifier/testcases

Wiktionary වෙතින්

Failed 2 tests failed.

Name Expected Actual
Passed test_format_qualifier_multiple_arguments
Passed test_format_qualifier_no_arguments
Passed test_format_qualifier_single_argument
Failed test_qualifier_t Lua error -- Module:qualifier/testcases:22: attempt to call field 'qualifier_t' (a nil value)
Failed test_sense_t Lua error -- Module:qualifier/testcases:29: attempt to call field 'sense_t' (a nil value)

local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()
local m_qualifier = require('Module:qualifier')

function suite:test_format_qualifier_no_arguments()
	local result = m_qualifier.format_qualifier({})
	suite:assertEquals('', result)
end

function suite:test_format_qualifier_single_argument()
	local result = m_qualifier.format_qualifier({'foo'})
	suite:assertEquals('<span class="ib-brac qualifier-brac">(</span><span class="ib-content qualifier-content">foo</span><span class="ib-brac qualifier-brac">)</span>', result)
end

function suite:test_format_qualifier_multiple_arguments()
	local result = m_qualifier.format_qualifier({'foo', 'bar'})
	suite:assertEquals('<span class="ib-brac qualifier-brac">(</span><span class="ib-content qualifier-content">foo<span class="ib-comma qualifier-comma">,</span> bar</span><span class="ib-brac qualifier-brac">)</span>', result)
end

function suite:test_qualifier_t()
	local frame = mw.getCurrentFrame():newChild({ title = 'test', args = { 'foo' } }):newChild{}
	local result = m_qualifier.qualifier_t(frame)
	suite:assertEquals('<span class="ib-brac qualifier-brac">(</span><span class="ib-content qualifier-content">foo</span><span class="ib-brac qualifier-brac">)</span>', result)
end


function suite:test_sense_t()
	local frame = mw.getCurrentFrame():newChild({ title = 'test', args = { 'foo' } }):newChild{}
	local result = m_qualifier.sense_t(frame)
	suite:assertEquals('<span class="ib-brac qualifier-brac">(</span><span class="ib-content qualifier-content">foo</span><span class="ib-brac qualifier-brac">)</span><span class="ib-colon sense-qualifier-colon">:</span>', result)
end


return suite
"https://si.wiktionary.org/w/index.php?title=Module:qualifier/testcases&oldid=167586" වෙතින් සම්ප්‍රවේශනය කෙරිණි