Module:template parser/testcases

Hello, you have come here looking for the meaning of the word Module:template parser/testcases. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:template parser/testcases, but we will also tell you about its etymology, its characteristics and you will know how to say Module:template parser/testcases in singular and plural. Everything you need to know about the word Module:template parser/testcases you have here. The definition of the word Module:template parser/testcases will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:template parser/testcases, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

All tests passed. (refresh)

TextExpectedActual
test_basic:
Passed
{{l|en|word}}
{"link", {"en", "word"}}{"link", {"en", "word"}}
Passed
{{t|cmn|大老二|tr={{m|cmn|dà lǎo èr}}}}
{"t", {"cmn", "大老二", tr="{{m|cmn|dà lǎo èr}}"}}{"t", {"cmn", "大老二", tr="{{m|cmn|dà lǎo èr}}"}}
Passed
{{t|akk|𒁀|tr=] qiāšu, BA}}
{"t", {"akk", "𒁀", tr="[[Image:B014ellst.png|30px]] qiāšu, BA"}}{"t", {"akk", "𒁀", tr="[[Image:B014ellst.png|30px]] qiāšu, BA"}}
TextExpectedActual
test_whitespace:
Passed
{{l| en | word
}}
{"link", {" en ", " word\n"}}{"link", {" en ", " word\n"}}
Passed
{{l| en | 2 = word
}}
{"link", {" en ", "word"}}{"link", {" en ", "word"}}
Passed
{{l| 1 = en | word
}}
{"link", {" word\n"}}{"link", {" word\n"}}

local tests = require "Module:UnitTests"

local parse_template = require "Module:template parser".parseTemplate
local highlight = require "Module:debug".highlight { lang = "text" }

function tests:check_templates(examples)
	local options = { nowiki = true }
	tests:iterate(examples, function(self, wikitext, expected)
		self:equals_deep(highlight(wikitext), {parse_template(wikitext)}, expected, options)
	end)
end

function tests:test_basic()
	local examples = {
		{
			"{{l|en|word}}",
			{ "link", { "en", "word" } },
		},
		{
			"{{t|cmn|大老二|tr={{m|cmn|dà lǎo èr}}}}",
			{ "t", { "cmn", "大老二", tr = "{{m|cmn|dà lǎo èr}}" } },
		},
		{
			"{{t|akk|𒁀|tr=] qiāšu, BA}}",
			{ "t", { "akk", "𒁀", tr = "] qiāšu, BA" } },
		}
	}
	self:check_templates(examples)
end

function tests:test_whitespace()
	self:check_templates {
		{ "{{l| en | word\n}}", { "link", { " en ", " word\n" } } },
		{ "{{l| en | 2 = word\n}}", { "link", { " en ", "word" } } },
		{ "{{l| 1 = en | word\n}}", { "link", { " word\n" } } },
	}
end

return tests