Jump to content

Module:dialect synonyms/testcases

From Wiktionary, the free dictionary

1 of 0 tests failed. (refresh)

TextExpectedActual
test_ko:
Script error during testing: Module:links:805: attempt to index field 'lang' (a nil value)
stack traceback:
	[C]: ?
	Module:links:805: in function 'full_link'
	Module:dialect_synonyms:228: in function 'format_word'
	Module:dialect_synonyms/testcases:35: in function <Module:dialect_synonyms/testcases:10>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:892: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require('Module:UnitTests')
local m = require('Module:dialect synonyms')
local m_links = require('Module:links')
local m_languages = require('Module:languages')

function tests:equalsC(name, actual, expected, options)
	return self:equals(name, mw.ustring.toNFC(actual), mw.ustring.toNFC(expected), options)
end

function tests:test_ko()
	local ko = m_languages.getByCode('ko')
	local vs = {
		['Seoul'] = {
			name = 'Seoul',
			code = 'ko-c',
			code_main = 'ko',
			parent = {},
		},
		['SE test'] = {
			name = 'SE test',
			code = 'ko-se',
			code_main = 'ko',
			parent = {},
		},
		['NE test'] = {
			name = 'NE test',
			code = 'ko-ne',
			code_main = 'ko',
			parent = {},
		},
	}

	self:equalsC(
		'(Seoul) ae-e merger',
		m.format_word(vs['Seoul'], '개 게'),
		m_links.full_link({
			lang = ko,
			term = '개 게',
			tr = 'ge ge',
		})
	)
	self:equalsC(
		'(SE) default pitch (on penultimate syllable)',
		m.format_word(vs['SE test'], '가나다'),
		m.format_word(vs['SE test'], '가\'나다')
	)
	self:equalsC(
		'(NE) default pitch (on final syllable)',
		m.format_word(vs['NE test'], '가나다'),
		m.format_word(vs['NE test'], '가나\'다')
	)
	self:equalsC(
		'(SE) default pitch, length',
		m.format_word(vs['SE test'], '가나@다'),
		m.format_word(vs['SE test'], '가\'나@다')
	)
	self:equalsC(
		'(SE) default pitch, nasal',
		m.format_word(vs['SE test'], '가나~다'),
		m_links.full_link({
			lang = ko,
			term = '가낭다',
			tr = 'gànã́dà',
		})
	)
	self:equalsC(
		'(SE) default pitch, nasal, length',
		m.format_word(vs['SE test'], '가나@~다'),
		m_links.full_link({
			lang = ko,
			term = '가낭다',
			tr = 'gànã́:dà',
		})
	)
	self:equalsC(
		'(SE) -',
		m.format_word(vs['SE test'], '가'),
		m_links.full_link({
			lang = ko,
			term = '가',
			tr = 'gà',
		})
	)
	self:equalsC(
		'(SE) default pitch, length',
		m.format_word(vs['SE test'], '가@'),
		m_links.full_link({
			lang = ko,
			term = '가',
			tr = 'gà:',
		})
	)
	self:equalsC(
		'(SE) default pitch, length, w/ digraph vowel, closed syllable',
		m.format_word(vs['SE test'], '금@'),
		m_links.full_link({
			lang = ko,
			term = '금',
			tr = 'gèu:m',
		})
	)
	self:equalsC(
		'(SE) pitch',
		m.format_word(vs['SE test'], '가'),
		m_links.full_link({
			lang = ko,
			term = '가',
			tr = 'gà',
		})
	)
	self:equalsC(
		'(SE) pitch, length',
		m.format_word(vs['SE test'], '가@'),
		m_links.full_link({
			lang = ko,
			term = '가',
			tr = 'gà:',
		})
	)
	self:equalsC(
		'(SE) pitch, length, w/ digraph vowel, closed syllable',
		m.format_word(vs['SE test'], '금@'),
		m_links.full_link({
			lang = ko,
			term = '금',
			tr = 'gèu:m',
		})
	)
	self:equalsC(
		'(SE) nasal',
		m.format_word(vs['SE test'], '나~'),
		m_links.full_link({
			lang = ko,
			term = '낭',
			tr = 'nã̀',
		})
	)
	self:equalsC(
		'(SE) nasal, length (@~)',
		m.format_word(vs['SE test'], '나@~'),
		m_links.full_link({
			lang = ko,
			term = '낭',
			tr = 'nã̀:',
		})
	)
	self:equalsC(
		'(SE) nasal, length (~@)',
		m.format_word(vs['SE test'], '나~@'),
		m_links.full_link({
			lang = ko,
			term = '낭',
			tr = 'nã̀:',
		})
	)
	self:equalsC(
		'(SE) nasal, w/ digraph vowel',
		m.format_word(vs['SE test'], '으~'),
		m_links.full_link({
			lang = ko,
			term = '응',
			tr = 'ẽ̀u',
		})
	)
	self:equalsC(
		'(SE) nasal, w/ non-digraph vowel sequence',
		m.format_word(vs['SE test'], '아이~'),
		m_links.full_link({
			lang = ko,
			term = '아잉',
			tr = 'áĩ̀',
		})
	)
	self:equalsC(
		'(SE) nasal, w/ closed syllable',
		m.format_word(vs['SE test'], '늠~'),
		'?'
	)
	self:equalsC(
		'(SE) weird markup order',
		m.format_word(vs['SE test'], '가나\'@다'),
		m.format_word(vs['SE test'], '가나@\'다')
	)
	self:equalsC(
		'(Seoul) nasal, dialect w/o nasalization',
		m.format_word(vs['Seoul'], '나~'),
		'?'
	)
	self:equalsC(
		'(Seoul) pitch, dialect w/o pitch',
		m.format_word(vs['Seoul'], '\'나'),
		'?'
	)
end

return tests