Module:syllables/testcases

local tests = require("Module:UnitTests")

local m_syllables = require("Module:syllables")

local langObjects = {}

local function tag(IPA) return ' ' .. IPA .. ' ' end

function tests:check(example, expected, langCode) if not langObjects[langCode] then langObjects[langCode] = require("Module:languages").getByCode(langCode) end self:equals(tag(example),		m_syllables.getVowels(example, langObjects[langCode]),		expected) end

function tests:test local examples = { { "/noʊ ˈhaɪweɪ ˈkaʊboɪz/", 5, "en" }, { "ðɛɚ", 2, "en" }, { "ðɛɹ", 1, "en" }, { "/avə(ʊ)ˈkeɪʃən/", 4, "en" }, { "/-eɪʃəs/", nil, "en"}, { "/ɛː.e.lí.o͜i.o/", 5, "grc" }, { "/vl̩k/", 1, "cs" }, { "/ˈɑːmiɑi̯smɑjoi̯tus/", 6, "fi" }, { "/ˈɛi̯ərə(n)/", 3, "nl" }, }	tests:iterate(examples, "check") end

return tests