local tests = require('Module:UnitTests')
local bases = require('Module:bases')
function tests:check_is_elidable(mot, attendu)
self:equals(mot, bases.is_elidable(mot), attendu)
end
function tests:check_is_locution(mot, attendu)
self:equals(mot, bases.is_locution(mot), attendu)
end
function tests:check_page_existe(mot, attendu)
self:equals(mot, bases.page_existe(mot), attendu)
end
function tests:check_ucfirst(mot, attendu)
self:equals(mot, bases.ucfirst(mot), attendu)
end
function tests:check_tableLength(name, tableau, attendu)
self:equals(name, bases.tableLength(tableau), attendu)
end
function tests:check_balise_langue(mot, lang, attendu)
self:equals(mot, bases.balise_langue(mot, lang), attendu)
end
function tests:check_lien_modele(mot, lang, ancre, dif, attendu)
self:equals(mot, bases.lien_modele(mot, lang, ancre, dif), attendu)
end
function tests:test_is_elidable()
self:check_is_elidable('mot', false)
self:check_is_elidable('arme', true)
self:check_is_elidable('Iran', true)
self:check_is_elidable('homme', true)
self:check_is_elidable('haricot', true)
end
function tests:test_is_locution()
self:check_is_locution('mot', false)
self:check_is_locution('nom commun', true)
self:check_is_locution('aujourd\'hui', false)
self:check_is_locution('aujourd’hui', false)
end
function tests:test_page_existe()
self:check_page_existe('mot', true)
self:check_page_existe('Wiktionnaire:Wikidémie', true)
self:check_page_existe('WT:Wikidémie', true)
self:check_page_existe('0bf5e33370d', false)
end
function tests:test_ucfirst()
self:check_ucfirst('mot', 'Mot')
self:check_ucfirst('Mot', 'Mot')
self:check_ucfirst('’are’are', '’Are’are')
self:check_ucfirst('’auhelawa', '’Auhelawa')
self:check_ucfirst('ǂhoan', 'ǂHoan')
self:check_ucfirst('ǃxóõ', 'ǃXóõ')
self:check_ucfirst('’o’ung', '’O’ung')
self:check_ucfirst('ǀxam', 'ǀXam')
self:check_ucfirst('ǁxegwi', 'ǁXegwi')
end
function tests:test_balise_langue()
self:check_balise_langue('mot', 'fr', '<bdi lang="fr" xml:lang="fr" class="lang-fr">mot</bdi>')
end
function tests:test_lien_modele()
self:check_lien_modele('chantre', 'fr', '', '', '<bdi lang="fr" xml:lang="fr" class="lang-fr">[[chantre#fr|chantre]]</bdi>')
self:check_lien_modele('chantre', 'fr', 'nom-1', '', '<bdi lang="fr" xml:lang="fr" class="lang-fr">[[chantre#fr-nom-1|chantre]]</bdi>')
self:check_lien_modele('חברה', 'he', '', 'חֲבֵרָה', '<bdi lang="he" xml:lang="he" class="lang-he">[[חברה#he|חֲבֵרָה]]</bdi>')
end
return tests