Jump to content

Module:Sandbox/Erutuon/author citation/testcases

From Wikipedia, the free encyclopedia
-- Example Unit tests for [[Module:Bananas]]. Click talk page to run tests.
local p = require "Module:UnitTests"
local mod = require "Module:Sandbox/Erutuon/author citation"

function p:test_link_author_citation()
	local examples = {
		{ "L.", "[[Carl Linnaeus|L.]]" },
		{ "Carl Linnaeus", "[[Carl Linnaeus]]" }, -- ???
		{
			"Cham. & Schldl.",
			"[[Adelbert von Chamisso|Cham.]] & [[Diederich Franz Leonhard von Schlechtendal|Schldl.]]"
		},
		{
			"(L.) A. J. Eames & B. Boivin",
			"([[Carl Linnaeus|L.]]) [[Arthur Johnson Eames|A. J. Eames]] & [[Joseph Robert Bernard Boivin|B. Boivin]]"
		},
		{
			"(L.) A.J.Eames & B.Boivin",
			"([[Carl Linnaeus|L.]]) [[Arthur Johnson Eames|A.J.Eames]] & [[Joseph Robert Bernard Boivin|B.Boivin]]"
		},
	}
	
	self:iterate(
		examples,
		function (self, example, expected)
			self:equals(example, mod.link_author_citation(example), expected)
		end)
end

return p