Module:IPA/testcases

-- Unit tests for Module:IPA. Click talk page to run tests. local p = require('Module:UnitTests')

local function getStripMarker(tag) return string.format(		'%s\'"`UNIQ--%s-00000000-QINU`"\'%s',		string.char(0x7f),		tag,		string.char(0x7f)	) end

function p:test_all self:preprocess_equals_many('', {		{			'foo',			'foo Category:Pages with plain IPA'		},		{			'foo|lang=en|class=foo bar|tooltip=Random tooltip',			' foo Category:Pages with plain IPA'		},		{			'foo|bar|tooltip=',			' Error: : unrecognized language code: foo Category:IPA template errors'		},		{			'foo bar|tooltip=',			' foo bar Category:Pages with plain IPA'		},		{			'foo bar|wrap=none|tooltip=',			' foo bar Category:Pages with plain IPA'		},		{			'foo bar|wrap=all|tooltip=',			' foo bar Category:Pages with plain IPA'		},		{			'1=foo bar|tooltip=',			' foo bar Category:Pages with plain IPA'		},		{			'foo bar baz qux|tooltip=',			' foo bar baz qux Category:Pages with plain IPA' },		{			'foo|audio=Example.ogg|tooltip=', ' foo ' .. getStripMarker('phonos') .. 'Category:Pages with plain IPACategory:Pages including recorded pronunciations' },		{			'fr|foo|-|Example.ogg', getStripMarker('templatestyles') .. ' French pronunciation: &#91;foo&#93; ' .. getStripMarker('phonos') .. 'Category:Pages with French IPACategory:Pages including recorded pronunciations' },		{			'fra|foo|lang', getStripMarker('templatestyles') .. ' French: &#91;foo&#93; Category:Pages with French IPA' },		{			'fr|foo|', ' &#91;foo&#93; Category:Pages with French IPA' },		{			'fr|foo|label=', ' &#91;foo&#93; Category:Pages with French IPA' },		{			'fr|foo|label=Random label:|small=no', ' Random label: &#91;foo&#93; Category:Pages with French IPA' },		{			'fr|foo|link=yes', getStripMarker('templatestyles') .. ' French pronunciation: &#91;foo&#93; Category:Pages with French IPA' },		{			'fr|foo|generic=yes', getStripMarker('templatestyles') .. ' French pronunciation: &#91;foo&#93; Category:Pages with French IPA' },		{			'en-AU|foo|lang', getStripMarker('templatestyles') .. ' Australian English: &#91;foo&#93; Category:Pages with Australian English IPA' },		{			'ace|foo', getStripMarker('templatestyles') .. ' Acehnese pronunciation: &#91;foo&#93; Category:Pages with Acehnese IPA' },		{			'en|foo', ' /foo/ Category:Pages with English IPA' },		{			'en-uk|foo', getStripMarker('templatestyles') .. ' UK: /foo/ Category:Pages with British English IPA' },		{			'en-uk|foo|link=yes', getStripMarker('templatestyles') .. ' UK: /foo/ Category:Pages with British English IPA' },		{			'sv-FI|foo|lang', getStripMarker('templatestyles') .. ' Finland Swedish: &#91;foo&#93; Category:Pages with Finland Swedish IPA' },		{			'ca-valencia|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Valencian: &#91;foo&#93; Category:Pages with Valencian IPA' },		{			'grc-x-attic|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Attic Greek: &#91;foo&#93; Category:Pages with Attic Greek IPA' },		{			'grc-x-aeolic|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Aeolic Greek: &#91;foo&#93; Category:Pages with Aeolic Greek IPA' },		{			'nan-TW|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Taiwanese Hokkien: &#91;foo&#93; Category:Pages with Taiwanese Hokkien IPA' },		{			'nl-BE|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Flemish: &#91;foo&#93; Category:Pages with Flemish IPA' },		{			'myn|foo|lang', getStripMarker('templatestyles') .. ' Mayan: &#91;foo&#93; Category:Pages with Mayan languages IPA' },		{			'myn|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Mayan: &#91;foo&#93; Category:Pages with Mayan languages IPA' },		{			'aus|foo|lang|link=yes', getStripMarker('templatestyles') .. ' Aboriginal: &#91;foo&#93; Category:Pages with Australian languages IPA' },		{			'und|foo', getStripMarker('templatestyles') .. ' IPA: &#91;foo&#93; Category:Pages with undetermined IPA' },		{			'en|', 'en Category:Pages with plain IPA' },	}, { combined = true, stripmarker = true })	self:preprocess_equals_preprocess_many(, , { { 'foo' }, { 'foo|lang' }, { 'foo|-|Example.ogg' }, { 'foo|' }, }, { combined = true, stripmarker = true }) end

return p