Документация

Юнит-тесты для модуля Languages. Создайте страницу с текстом {{#invoke:Languages/tests|run_tests}}

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

function p:test_getRefHtml()
    self:preprocess_equals('{{#invoke:Languages | getRefHtmlFrame | }}', '')
    self:preprocess_equals('{{#invoke:Languages | getRefHtmlFrame | xx }}', '')
    self:preprocess_equals('{{#invoke:Languages | getRefHtmlFrame | en }}', '<span class="ref-info" title="Английский язык" style="cursor:help">(англ.)</span>')
    self:preprocess_equals('{{#invoke:Languages | getRefHtmlFrame | ru }}', '<span class="ref-info" title="Русский язык" style="cursor:help">(рус.)</span>')
end

function p:test_getWikidataRefHtml()
    self:preprocess_equals('{{#invoke:Languages | getWikidataRefHtmlFrame | }}', '')
    self:preprocess_equals('{{#invoke:Languages | getWikidataRefHtmlFrame | QNNN }}', '')
    self:preprocess_equals('{{#invoke:Languages | getWikidataRefHtmlFrame | Q1860 }}', '<span class="ref-info" title="Английский язык" style="cursor:help">(англ.)</span>')
    self:preprocess_equals('{{#invoke:Languages | getWikidataRefHtmlFrame | Q7737 }}', '<span class="ref-info" title="Русский язык" style="cursor:help">(рус.)</span>')
end

return p