มอดูล: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('debug=yes', {
		{
			'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: IPA: 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 IPA:Category:Pages including recorded pronunciations'
		},
		{
			'fr|foo
			getStripMarker('templatestyles') .. 'French pronunciation: Help:IPA/French|foo ' .. getStripMarker('phonos') .. ':Category:Pages with French IPA:Category:Pages including recorded pronunciations'
		},
		{
			'fra|foo|lang',
			getStripMarker('templatestyles') .. 'French: Help:IPA/French|foo:Category:Pages with French IPA'
		},
		{
			'fr|foo|',
			'Help:IPA/French|foo:Category:Pages with French IPA'
		},
		{
			'fr|foo|label=',
			'Help:IPA/French|foo:Category:Pages with French IPA'
		},
		{
			'fr|foo|label=Random label:|small=no',
			 'Random label: Help:IPA/French|foo:Category:Pages with French IPA'
		},
		{
			'fr|foo|link=yes',
			getStripMarker('templatestyles') .. 'French pronunciation: Help:IPA/French|foo:Category:Pages with French IPA'
		},
		{
			'fr|foo|generic=yes',
			getStripMarker('templatestyles') .. 'French pronunciation: Help:IPA|foo:Category:Pages with French IPA'
		},
		{
			'en-AU|foo|lang',
			getStripMarker('templatestyles') .. 'Australian English: Help:IPA|foo:Category:Pages with Australian English IPA'
		},
		{
			'ace|foo',
			getStripMarker('templatestyles') .. 'Acehnese pronunciation: Help:IPA|foo: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: Help:IPA/Swedish|foo:Category:Pages with Finland Swedish IPA'
		},
		{
			'ca-valencia|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Valencian: Help:IPA/Catalan|foo:Category:Pages with Valencian IPA'
		},
		{
			'grc-x-attic|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Attic Greek: Help:IPA/Greek|foo:Category:Pages with Attic Greek IPA'
		},
		{
			'grc-x-aeolic|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Aeolic Greek: Help:IPA|foo:Category:Pages with Aeolic Greek IPA'
		},
		{
			'nan-TW|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Taiwanese Hokkien: Help:IPA/Taiwanese Hokkien|foo:Category:Pages with Taiwanese Hokkien IPA'
		},
		{
			'nl-BE|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Flemish: Help:IPA/Dutch|foo:Category:Pages with Flemish IPA'
		},
		{
			'myn|foo|lang',
			getStripMarker('templatestyles') .. 'Mayan: Help:IPA/Mayan|foo:Category:Pages with Mayan languages IPA'
		},
		{
			'myn|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Mayan: Help:IPA/Mayan|foo:Category:Pages with Mayan languages IPA'
		},
		{
			'aus|foo|lang|link=yes',
			getStripMarker('templatestyles') .. 'Aboriginal: Help:IPA/Australian languages|foo:Category:Pages with Australian languages IPA'
		},
		{
			'und|foo',
			getStripMarker('templatestyles') .. 'IPA: Help:IPA|foo: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
		{ 'foo|' },
	}, { combined = true, stripmarker = true })
end
return p