Module:User:Justinrleung/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is the unit-testing module for Module:User:Justinrleung.

2 of 33 tests failed. (refresh)

TextExpectedActualDiffers at
test_link:
Script error during testing: Module:links:495: The first argument to the function language_link must be a table. See Module:links/documentation for more information.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:links:495: in function <Module:links:493>
	(tail call): ?
	Module:User:Justinrleung/testcases:32: in function 'link'
	Module:User:Justinrleung/testcases:36: in function <Module:User:Justinrleung/testcases:35>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:856: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActualDiffers at
test_pfs_to_hrs:
Passedpfs=kîm-ngitgim´ ngid`gim´ ngid`
Passedpfs=Kîm-ngitgim´ ngid`gim´ ngid`
Passedpfs=Mâ-lòi-sî-áma´ loiˇ xi´ a`ma´ loiˇ xi´ a`
Passedpfs=ngòannguanˇnguanˇ
Passedpfs=ngàingaiˇngaiˇ
Passedpfs=ngìngiˇngiˇ
Passedpfs=phangpangpang
Passedpfs=pha̍kpagpag
Passedpfs=sṳ̀nsiinˇsiinˇ
Passedpfs=sṳ̍tsiidsiid
Passedpfs=sṳtsiid`siid`
Passedpfs=yènienˇienˇ
Passedpfs=yitid`id`
TextExpectedActualDiffers at
test_poj_check_invalid:
Script error during testing: Module:User:Justinrleung/testcases:60: attempt to call field 'poj_check_invalid' (a nil value)
stack traceback:
	[C]: in function 'poj_check_invalid'
	Module:User:Justinrleung/testcases:60: in function 'poj_check_invalid'
	Module:User:Justinrleung/testcases:64: in function <Module:User:Justinrleung/testcases:63>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:856: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActualDiffers at
test_py_tongyong:
Passedtōngyòng pīnyīntongyòng pinyintongyòng pinyin
Passedxiǎosiǎosiǎo
Passedmāmamamåmamå
Passedxióngmāosyóngmaosyóngmao
Passedzhǎngguǎnjhǎngguǎnjhǎngguǎn
Passedcyúcyú
Passed
Passedlyǔlyǔ
Passedfēnglàngfonglàngfonglàng
PassedQīnghǎiCinghǎiCinghǎi
PassedFújiànFújiànFújiàn
PassedGuǎngdōngGuǎngdongGuǎngdong
PassedHéběiHéběiHéběi
PassedHúnánHúnánHúnán
PassedZhèjiāngJhèjiangJhèjiang
PassedNèiménggǔNèiménggǔNèiménggǔ
PassedShǎnxīShǎnsiShǎnsi
PassedXīnjiāngSinjiangSinjiang
PassedXīzàngSizàngSizàng
PassedSìchuānSìhchuanSìhchuan

local p = require('Module:UnitTests')
local m = require('Module:User:Justinrleung')

function p:py_tongyong(text, expected)
	self:equals(text, m.py_tongyong(text), expected)
end

function p:test_py_tongyong(text, expected)
	self:py_tongyong("tōngyòng pīnyīn", "tongyòng pinyin")
	self:py_tongyong("xiǎo", "siǎo")
	self:py_tongyong("māma", "mamå")
	self:py_tongyong("xióngmāo", "syóngmao")
	self:py_tongyong("zhǎngguǎn", "jhǎngguǎn")
	self:py_tongyong("qú", "cyú")
	self:py_tongyong("lǔ", "lǔ")
	self:py_tongyong("lǚ", "lyǔ")
	self:py_tongyong("fēnglàng", "fonglàng")
	self:py_tongyong("Qīnghǎi", "Cinghǎi")
	self:py_tongyong("Fújiàn", "Fújiàn")
	self:py_tongyong("Guǎngdōng", "Guǎngdong")
	self:py_tongyong("Héběi", "Héběi")
	self:py_tongyong("Húnán", "Húnán")
	self:py_tongyong("Zhèjiāng", "Jhèjiang")
	self:py_tongyong("Nèiménggǔ", "Nèiménggǔ")
	self:py_tongyong("Shǎnxī", "Shǎnsi")
	self:py_tongyong("Xīnjiāng", "Sinjiang")
	self:py_tongyong("Xīzàng", "Sizàng")
	self:py_tongyong("Sìchuān", "Sìhchuan")
end

function p:link(text, expected)
	self:equals(text, m.link(text), expected)
end

function p:test_link()
	self:link('text', '')
end

function p:pfs_to_hrs(text, expected)
	self:equals(text, m.pfs_to_hrs(text), expected)
end

function p:test_pfs_to_hrs()
	self:pfs_to_hrs('pfs=kîm-ngit', 'gim´ ngid`')
	self:pfs_to_hrs('pfs=Kîm-ngit', 'gim´ ngid`')
	self:pfs_to_hrs('pfs=Mâ-lòi-sî-á', 'ma´ loiˇ xi´ a`')
	self:pfs_to_hrs('pfs=ngòan', 'nguanˇ')
	self:pfs_to_hrs('pfs=ngài', 'ngaiˇ')
	self:pfs_to_hrs('pfs=ngì', 'ngiˇ')
	self:pfs_to_hrs('pfs=phang', 'pang')
	self:pfs_to_hrs('pfs=pha̍k', 'pag')
	self:pfs_to_hrs('pfs=sṳ̀n', 'siinˇ')
	self:pfs_to_hrs('pfs=sṳ̍t', 'siid')
	self:pfs_to_hrs('pfs=sṳt', 'siid`')
	self:pfs_to_hrs('pfs=yèn', 'ienˇ')
	self:pfs_to_hrs('pfs=yit', 'id`')
end

function p:poj_check_invalid(text, expected)
	self:equals(text, m.poj_check_invalid(text), expected)
end

function p:test_poj_check_invalid()
	self:poj_check_invalid('khoê', 'khôe')
	self:poj_check_invalid('khoâ', 'khôa')
end

return p