模块:Effective protection level/testcases

-- [[Module:Test]]的單元測試範例,前往討論頁以執行測試。
local p = require('Module:UnitTests')

function p:test_edit()
	self:preprocess_equals_many('{{#invoke:Effective protection level|edit|', '}}', {
		{'MediaWiki:Spam-blacklist', 'sysop'},
		{'User:Example/common.js', 'interfaceadmin'},
		{'User:Example/common.css', 'interfaceadmin'},
		{'User:Example/common.json', 'sysop'},
		{'Mediawiki:common.js', 'interfaceadmin'},
		{'Mediawiki:common.css', 'interfaceadmin'},
		{'Mediawiki:common.json', 'sysop'},
		{'Template:Checkuser', 'sysop'},
		{'Template:Bulletin', 'autoconfirmed'},
		{'Template:Pp-jupe', 'sysop'},
		{'User:Liangent-bot/message/ts-ntvc-dup-vfd', 'sysop'},
		{'Module:About', 'templateeditor'},
		{'ClearType', '\n*'},
	}, {nowiki=1})
end

function p:test_move()
	self:preprocess_equals_many('{{#invoke:Effective protection level|move|', '}}', {
		{'MediaWiki:Spam-blacklist', 'sysop'},
		{'User:Example/common.js', 'interfaceadmin'},
		{'User:Example/common.css', 'interfaceadmin'},
		{'User:Example/common.json', 'sysop'},
		{'Mediawiki:common.js', 'interfaceadmin'},
		{'Mediawiki:common.css', 'interfaceadmin'},
		{'Mediawiki:common.json', 'sysop'},
		{'Template:Checkuser', 'sysop'},
		{'Template:Bulletin', 'autoconfirmed'},
		{'Template:Pp-jupe', 'sysop'},
		{'User:Liangent-bot/message/ts-ntvc-dup-vfd', 'sysop'},
		{'Module:Sandbox', 'autoconfirmed'},
		{'File:HomuWitch_teara.gif', 'filemover'},
		{'ClearType', 'autoconfirmed'},
	}, {nowiki=1})
end

function p:test_upload()
	self:preprocess_equals_many('{{#invoke:Effective protection level|upload|', '}}', {
		{'File:QWERTYUIIOOOO.jpg', 'autoconfirmed'},
	}, {nowiki=1})
end

return p