For performance reasons, the test cases have been divided over several subpages:
-- Unit tests for [[Module:Wd]]. Click talk page to run tests.
local p = require('Module:UnitTests')
* [[Module:Wd/testcases/1]] – compares the output of [[Module:Wd]] against expected values
function p._test(frame)
* [[Module:Wd/testcases/2]] – compares the output of [[Module:Wd/sandbox]] against expected values
--require('Module:Wd').property(frame)
* [[Module:Wd/testcases/3]] – compares the output of [[Module:Wd/sandbox]] against the output of [[Module:Wd]]
local t = { a = 5, b = 6, };
As of 2023, a new version of testcases is being prepared at [[Module:Wd/sandbox/testcases]].
--loadSubmodules(frame)
loadSubmodules()
return mw.dumpObject(copyTable(t)) .. "\n\n" ..
frame:getTitle() .. "\n\n" ..
errorText("unknown-data-type")
end
function p:test()
self:preprocess_equals('{{#invoke:Wd|property }}', '')
self:preprocess_equals('{{#invoke:Wd|property | hello}}', '')
self:preprocess_equals('{{#invoke:Wd|_property }}', '')
self:preprocess_equals('{{#invoke:Wd|_property | hello}}', '')
self:preprocess_equals('{{#invoke:Wd/testcases|_test | hello}}', '')
self:preprocess_equals('{{#invoke:Wd|main|qualifier|property|P485|Q24568958|P856|eid=Q131333|format=\[%q %p\]}}', '')
self:preprocess_equals('{{wikidata|qualifier|property|P485|Q24568958|P856|eid=Q131333|format=\[%q %p\]}}', '')
self:preprocess_equals('{{#invoke:wd|property|eid=Q55|P395}}', '')
end
return p
|