Returns a function that creates testcases for a single romanization function.
Can be used by placing the following code in the testcases module:
return require("Module:transliteration module testcases") {
module = "module name", -- for instance, "grc-translit"; module must export a tr function
examples = {
{ example1, expected1 },
{ example2, expected2, script_if_different_from_below },
{ example2, expected2, script_if_different_from_below, lang_if_different_from_below },
-- and so on
-- Strings may be inserted to act as subheaders in the table of results.
},
sc = "script_code", lang = "language_code",
-- options, e.g. nolink = true
}
The 'module' argument may be the transliteration function itself if so desired.
Positional arguments are supported and still used. There are then four required and one optional argument. The required arguments are module
, examples
, sc
and lang
as above. The fifth and optional argument is options
, which gather the options as above together.
Options:
nolink
func_before_link
nil
. This returned string is then treated as the name of a page in Wiktionary, unless option nolink
is set.func_with_link
nil
. It returns the string to be output in the text field.output_display
display
option as passed to function equals
of Module:UnitTests.As with Module:UnitTests, the documentation page should have {{#invoke:testcases module name here|run_tests}}
.