Jump to content

Module:usex/templates/testcases

Wiktionary වෙතින්

Failed 2 tests failed.

Name Expected Actual
Failed test_usex_t_example <div class="h-usage-example"><i class="Latn mention e-example" lang="fr">Ceci est un exemple</i> <dl><dd><span class="e-translation">This is an example</span></dd></dl></div> <div class="h-usage-example"><i class="Latn mention e-example" lang="fr">Ceci est un exemple</i><dl><dd><span class="e-translation">This is an example</span></dd></dl></div>
Failed test_usex_t_quote <div class="h-quotation"><span class="Latn e-quotation" lang="fr">Ceci est un quote</span> <dl><dd><span class="e-translation">This is a quotation</span></dd></dl></div> <div class="h-quotation"><span class="Latn e-quotation" lang="fr">Ceci est un quote</span><dl><dd><span class="e-translation">This is a quotation</span></dd></dl></div>

local ScribuntoUnit = require('Module:ScribuntoUnit')
local m_usex_templates = require('Module:usex/templates')
local suite = ScribuntoUnit:new()

local function usex_t(args)
    local frame = mw.getCurrentFrame():newChild{ title = 'test', args = args }
    return m_usex_templates.usex_t(frame:newChild{})
end

local function usex_t_quote(args)
    local frame = mw.getCurrentFrame():newChild{ title = 'test', args = args }
    return m_usex_templates.usex_t(frame:newChild{ args = { quote = '1' } })
end

function suite:test_usex_t_example()
    local result = usex_t { 'fr', 'Ceci est un exemple', 'This is an example' }
    suite:assertEquals('<div class="h-usage-example"><i class="Latn mention e-example" lang="fr">Ceci est un exemple</i> <dl><dd><span class="e-translation">This is an example</span></dd></dl></div>', result)
end

function suite:test_usex_t_quote()
    local result = usex_t_quote { 'fr', 'Ceci est un quote', 'This is a quotation' }
    suite:assertEquals('<div class="h-quotation"><span class="Latn e-quotation" lang="fr">Ceci est un quote</span> <dl><dd><span class="e-translation">This is a quotation</span></dd></dl></div>', result)
end

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