Module:Ancient Greek/typing/testcases
MyWikiBiz, Author Your Legacy — Saturday December 28, 2024
Jump to navigationJump to searchDocumentation for this module may be created at Module:Ancient Greek/typing/testcases/doc
local tests = require("Module:UnitTests") local tag = mw.text.tag local decompose = mw.ustring.toNFD local Latin_to_Greek = require("Module:Ancient Greek/typing").to_Greek local function tag_Greek(text) return tag("span", { lang = "grc" }, text) end local function code(text) return tag("code", nil, text) end local options = { display = tag_Greek, show_difference = true } function tests:check(example, expected) self:equals(code(example), decompose(Latin_to_Greek(example)), decompose(expected), options) end function tests:test() local examples = { { "a__i", "ᾱͅ" }, { "a)lhqh/s", "ἀληθής" }, { "a)lhqhs*", "ἀληθησ" }, { "a)lhqhs-", "ἀληθησ-" }, { "a^)nh/r", "ᾰ̓νήρ" }, { "Phlhi+a/dhs", "Πηληϊάδης" }, { "Phlhi^+a^/dhs", "Πηληῐ̈ᾰ́δης" }, { "Πηληϊ^ά^δης", "Πηληῐ̈ᾰ́δης" }, { "e)a_/n", "ἐᾱ́ν" }, { "ἐά_ν", "ἐᾱ́ν" }, { "pa=sa^", "πᾶσᾰ" }, { "u_(mei=s", "ῡ̔μεῖς" }, { "a/)^ner", "ᾰ̓́νερ" }, { "a/^)ner", "ᾰ̓́νερ" }, { "a)/^ner", "ᾰ̓́νερ" }, { "a)^/ner", "ᾰ̓́νερ" }, { "dai+/frwn", "δαΐφρων" }, { "dai/+frwn", "δαΐφρων" }, } self:iterate(examples, "check") end return tests