Module:Last month/testcases

From Wikisource
Jump to navigation Jump to search
-- Unit tests for [[Module:Edition]]. Go to the talk page to view test results.
local testSuite = require('Module:UnitTests')

local LM = require('Module:Last month')

-- test the core getLinks functions
function testSuite:test_n1()

	self:preprocess_equals_many('{{#invoke:Last month | last_month |', '}}', {
		{ 'year=2021 | month = 05', '2021-04' },
		{ 'year=2021 | month = 01', '2020-12' },
		{ 'year=2021 | month = 05 | n = 4', '2021-01' },
		{ 'year=2021 | month = 05 | n = 0', '2021-05' },
		{ 'year=2021 | month = 05 | n = -1', '2021-06' },
		{ 'year=2021 | month = 12 | n = -1', '2022-01' },
		{ 'year=2021 | month = 5 | format = %Y', '2021' },
		{ 'year=2021 | month = 5 | format = %m', '04' },
		{ 'year=2021 | month = 5 | format = %B', 'April' },
	})
end

return testSuite