Modul:KRW/testcases

Aus Wiktionary, dem freien Wörterbuch

Die Dokumentation für dieses Modul kann unter Modul:KRW/testcases/Doku erstellt werden

-- Unit tests for [[Module:KRW]]. Klicke die Diskussionsseite an, um die Tests zu starten.

local p = require('Module:UnitTests')
 
function p:test_createLink()
  local t = "{{#invoke:KRW|createLink"
  local path = "[" .. mw.site.server .. mw.site.scriptPath ..
    "/index.php?title=Kategorie:Rückläufige_Wörterliste_("

  self:preprocess_equals(t .. '|Text ohne Minus|Deutsch}}', "Text ohne Minus")

  self:preprocess_equals(t .. '||Deutsch}}', "")

  self:preprocess_equals(t .. '|-a|Deutsch}}',
    path .. "Deutsch" .. ")&pagefrom=" .. "a -a]")

  self:preprocess_equals(t .. '|-a|Englisch}}',
    path .. "Englisch" .. ")&pagefrom=" .. "a -a]")

  self:preprocess_equals(t .. '|-eim|Deutsch}}',
    path .. "Deutsch" .. ")&pagefrom=" .. "mie -eim]")

  self:preprocess_equals(t .. '|-a, -o|Deutsch}}',
    path .. "Deutsch" .. ")&pagefrom=" .. "a -a], " ..
    path .. "Deutsch" .. ")&pagefrom=" .. "o -o]")

  self:preprocess_equals(t .. '|-ah, -oh -e-o, -oo|Deutsch}}',
    path .. "Deutsch" .. ")&pagefrom=" .. "ha -ah], " ..
    path .. "Deutsch" .. ")&pagefrom=" .. "ho -oh] " ..
    path .. "Deutsch" .. ")&pagefrom=" .. "o-e -e-o], " ..
    path .. "Deutsch" .. ")&pagefrom=" .. "oo -oo]")

  self:preprocess_equals(t .. '|-is-Dur|Deutsch}}',
    path .. "Deutsch" .. ")&pagefrom=" .. "ruD-si -is-Dur]")

  self:preprocess_equals(t .. "|-oh<br />-eau; -ot – ''in französischen Fremdwörtern''|Deutsch}}",
    path .. "Deutsch" .. ")&pagefrom=" .. "ho -oh] <br />" ..
    path .. "Deutsch" .. ")&pagefrom=" .. "uae -eau]; " ..
    path .. "Deutsch" .. ")&pagefrom=" .. "to -ot] – ''in französischen Fremdwörtern''")

end
 
return p