local t = require("Modul:UnitTests")
local mut = require("Modul:gl-subst")
local function nowikiPipe(str)
return mw.ustring.gsub(str, "|", "<nowiki>|</nowiki>")
end
function t:test01_basic()
self:equals_deep('mut.test("óxido", "gl-subst-m", "export")', mut.test("óxido", "gl-subst-m", "export"),
{
sing="óxido",
plur="óxidos"
}
)
self:equals_deep('mut.test("cervexa", "gl-subst-f", "export")', mut.test("cervexa", "gl-subst-f", "export"),
{
sing="cervexa",
plur="cervexas"
}
)
self:equals_deep('mut.test("vidente", "gl-subst-mf", "export")', mut.test("vidente", "gl-subst-mf", "export"),
{
sing="vidente",
plur="videntes"
}
)
end
function t:test02_r_ending()
self:equals_deep('mut.test("calor", "gl-subst-m", "export")', mut.test("calor", "gl-subst-m", "export"),
{
sing="calor",
plur="calores"
}
)
end
function t:test03_z_ending()
self:equals_deep('mut.test("vez", "gl-subst-f", "export")', mut.test("vez", "gl-subst-f", "export"),
{
sing="vez",
plur="veces"
}
)
end
function t:test04_il_ending()
self:equals_deep('mut.test("mil", "gl-subst-m", "export")', mut.test("mil", "gl-subst-m", "export"),
{
sing="mil",
plur="?"
}
)
self:equals_deep(nowikiPipe('mut.test("mil", "gl-subst-m|2=miles", "export")'), mut.test("mil", "gl-subst-m|2=miles", "export"),
{
sing="mil",
plur="miles"
}
)
self:equals_deep('mut.test("chamil", "gl-subst-m", "export")', mut.test("chamil", "gl-subst-m", "export"),
{
sing="chamil",
plur="?"
}
)
self:equals_deep(nowikiPipe('mut.test("chamil", "gl-subst-m|2=chamís", "export")'), mut.test("chamil", "gl-subst-m|2=chamís", "export"),
{
sing="chamil",
plur="chamís"
}
)
end
function t:test05_l_ending()
self:equals_deep('mut.test("animal", "gl-subst-m", "export")', mut.test("animal", "gl-subst-m", "export"),
{
sing="animal",
plur="?"
}
)
self:equals_deep(nowikiPipe('mut.test("animal", "gl-subst-m|2=animais", "export")'), mut.test("animal", "gl-subst-m|2=animais", "export"),
{
sing="animal",
plur="animais"
}
)
self:equals_deep('mut.test("espiral", "gl-subst-f", "export")', mut.test("espiral", "gl-subst-f", "export"),
{
sing="espiral",
plur="?"
}
)
self:equals_deep(nowikiPipe('mut.test("espiral", "gl-subst-f|2=espirais", "export")'), mut.test("espiral", "gl-subst-m|2=espirais", "export"),
{
sing="espiral",
plur="espirais"
}
)
self:equals_deep('mut.test("sol", "gl-subst-m", "export")', mut.test("sol", "gl-subst-m", "export"),
{
sing="sol",
plur="?"
}
)
self:equals_deep(nowikiPipe('mut.test("sol", "gl-subst-f|2=soles", "export")'), mut.test("sol", "gl-subst-m|2=soles", "export"),
{
sing="sol",
plur="soles"
}
)
end
function t:test06_unemphasized_vowel_s_ending()
self:equals_deep('mut.test("paraugas", "gl-subst-m", "export")', mut.test("paraugas", "gl-subst-m", "export"),
{
sing="paraugas",
plur="paraugas"
}
)
self:equals_deep('mut.test("andas", "gl-subst-f", "export")', mut.test("andas", "gl-subst-f", "export"),
{
sing="andas",
plur="andas"
}
)
self:equals_deep('mut.test("albatros", "gl-subst-m", "export")', mut.test("albatros", "gl-subst-m", "export"),
{
sing="albatros",
plur="albatros"
}
)
end
function t:test07_x_or_consonant_s_ending()
self:equals_deep('mut.test("tórax", "gl-subst-m", "export")', mut.test("tórax", "gl-subst-m", "export"),
{
sing="tórax",
plur="tórax"
}
)
self:equals_deep('mut.test("luns", "gl-subst-m", "export")', mut.test("luns", "gl-subst-m", "export"),
{
sing="luns",
plur="luns"
}
)
end
function t:test08_emphasized_s_ending()
self:equals_deep('mut.test("albanés", "gl-subst-m", "export")', mut.test("albanés", "gl-subst-m", "export"),
{
sing="albanés",
plur="albaneses"
}
)
self:equals_deep(nowikiPipe('mut.test("deus", "gl-subst-m|2=deuses", "export")'), mut.test("deus", "gl-subst-m|2=deuses", "export"),
{
sing="deus",
plur="deuses"
}
)
end
function t:test07_n_ending()
self:equals_deep('mut.test("can", "gl-subst-m", "export")', mut.test("can", "gl-subst-m", "export"),
{
sing="can",
plur="cans"
}
)
end
function t:test08_other_consonant_ending()
self:equals_deep('mut.test("club", "gl-subst-m", "export")', mut.test("club", "gl-subst-m", "export"),
{
sing="club",
plur="clubs"
}
)
end
return t