Jump to content

Module:Mainspace editnotice/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
start testcases
 
switch to ScribuntoUnit
Line 1: Line 1:
-- Unit tests for [[Module:Mainspace editnotice]]. Click talk page to run tests.
-- Unit tests for [[Module:Mainspace editnotice]]. Click talk page to run tests.
local p = require('Module:UnitTests')


local ScribuntoUnit = require('Module:ScribuntoUnit')
function p:assertNoticeEquals(page, notice)
local suite = ScribuntoUnit:new()
self:preprocess_equals_preprocess('{{#invoke:Mainspace editnotice|main|'..page..'}}',

notice, {nowiki=1})
function suite:assertNoticeEquals(page, notice)
self:assertEquals(
mw.text.killMarkers(suite.frame:preprocess(notice)),
mw.text.killMarkers(suite.frame:preprocess(
'{{#invoke:Mainspace editnotice|main|page='..page..'}}'))
)
end
end


function p:testBlp()
function suite:testBlp()
self:assertNoticeEquals('Barack Obama', '{{BLP editintro}}')
self:assertNoticeEquals('Barack Obama', '{{BLP editintro}}')
end
end


return p
return suite

Revision as of 17:08, 29 January 2024

-- Unit tests for [[Module:Mainspace editnotice]]. Click talk page to run tests.

local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()

function suite:assertNoticeEquals(page, notice)
	self:assertEquals(
		mw.text.killMarkers(suite.frame:preprocess(notice)), 
		mw.text.killMarkers(suite.frame:preprocess(
			'{{#invoke:Mainspace editnotice|main|page='..page..'}}'))
	)
end

function suite:testBlp()
	self:assertNoticeEquals('Barack Obama', '{{BLP editintro}}')
end

return suite