Module:User:Oyunqi/ug-headword2/testcases2

-- Unit tests for Module:User:Oyunqi/ug-headword2. Refresh page to run tests. local tests = require('Module:UnitTests') local ug_headword = require('Module:User:Oyunqi/ug-headword2') local full_link = require('Module:links').full_link local lang = require('Module:languages').getByCode('ug') local sc = require('Module:scripts').getByCode('ug-Arab')

local function link(term) return full_link{lang = lang, sc = sc, term = term} end

function tests:do_test(pos) local work if pos == "noun" then local make_plural_noun = ug_headword.make_plural_noun function work(text) return make_plural_noun(text, '', 'yes') end elseif pos == "adjective" then --work = ug_headword.biblical end return function (self, text, expected_plural, comment) self:equals(link(text), work(text), expected_plural, {comment=comment}) end end

function tests:test_headword_noun local examples = { "auto", { 'بالا', "بالىلار" }, "no changes", { 'بالا', "بالالار", "change=no" }, }	self:iterate(examples, self:do_test("noun")) end return tests