Module:pl-IPA/testcases

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:pl-IPA/testcases/documentation. [edit]
Useful links: root pageroot page's subpagestransclusionstested module

All tests passed. (refresh)

test_ipa:
Text Expected Actual
Passed klacz klat͡ʂ klat͡ʂ
Passed odrzut ˈɔd.ʐut ˈɔd.ʐut
Passed zupa ˈzu.pa ˈzu.pa
Passed przeżytek pʂɛˈʐɨ.tɛk pʂɛˈʐɨ.tɛk
Passed awers ˈa.vɛrs ˈa.vɛrs
Passed abażur aˈba.ʐur aˈba.ʐur
Passed haczyk ˈha.t͡ʂɨk ˈha.t͡ʂɨk
Passed różdżka ˈruʂ.t͡ʂka ˈruʂ.t͡ʂka
Passed kwaz-inorma kfa.ziˈnɔr.ma kfa.ziˈnɔr.ma
Passed na-ukowiec na.uˈkɔ.vʲɛt͡s na.uˈkɔ.vʲɛt͡s
Passed dżawa ˈd͡ʐa.va ˈd͡ʐa.va

local tests = require('Module:UnitTests')
local m_pl_ipa = require('Module:pl-IPA')
 
local function format_ipa(ipa)
	return '<span class="IPA">' .. ipa .. '</span>'
end
 
function tests:check_ipa(word, expected, artificial)
	self:equals(
		'<i class="mention Latn" lang="pl">[[' .. word .. '#Polish|' .. word .. ']]</i>',
		format_ipa(m_pl_ipa.IPA(word)), format_ipa(expected)
	)
end
 
function tests:check_ipa_artif(word, expected, artificial)
	self:equals(
		'<code>' .. word .. '</code>',
		format_ipa(m_pl_ipa.IPA(word)), format_ipa(expected)
	)
end
 
function tests:test_ipa()
	self:check_ipa('klacz'    , 'klat͡ʂ'     )
	self:check_ipa('odrzut'   , 'ˈɔd.ʐut'   )
	self:check_ipa('zupa'     , 'ˈzu.pa'    )
	self:check_ipa('przeżytek', 'pʂɛˈʐɨ.tɛk')
	self:check_ipa('awers'    , 'ˈa.vɛrs'   )
	self:check_ipa('abażur'   , 'aˈba.ʐur'  )
	self:check_ipa('haczyk'   , 'ˈha.t͡ʂɨk'  )
	self:check_ipa('różdżka'  , 'ˈruʂ.t͡ʂka' )
 
	self:check_ipa_artif('kwaz-inorma', 'kfa.ziˈnɔr.ma')
	self:check_ipa_artif('na-ukowiec', 'na.uˈkɔ.vʲɛt͡s')
	self:check_ipa_artif('dżawa', 'ˈd͡ʐa.va')
end
 
return tests