模組:Wd/testcases/3

--  Unit tests for [[Module:Wd]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local wd = require('Module:Wd')
local wdsb = require('Module:Wd/sandbox')

function p:test_sandbox_vs_live()
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P395}}', wd._property{'Q55','P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|P395}}', wd._property{'P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=Q55|P395}}', wd._property{eid='Q55','P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=|P395}}', wd._property{eid='','P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|' .. wdsb._title{'Q55'} .. '|P395}}', wd._property{wd._title{'Q55'},'P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|:' .. wdsb._title{'Q55'} .. '|P395}}', wd._property{':' .. wd._title{'Q55'},'P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|page=' .. wdsb._title{'Q55'} .. '|P395}}', wd._property{page=wd._title{'Q55'},'P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|page=:' .. wdsb._title{'Q55'} .. '|P395}}', wd._property{page=':' .. wd._title{'Q55'},'P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|page=|P395}}', wd._property{page='','P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|edit|Q55|P395}}', wd._property{'edit','Q55','P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|edit@end|Q55|P395}}', wd._property{'edit@end','Q55','P395'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=Q55|Q2|P31}}', wd._property{eid='Q55','Q2','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|page=' .. wdsb._title{'Q55'} .. '|Q2|P31}}', wd._property{page=wd._title{'Q55'},'Q2','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|page=' .. wdsb._title{'Q55'} .. '|eid=Q2|P31}}', wd._property{page=wd._title{'Q55'},eid='Q2','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|P625|P31}}', wd._property{'P625','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Property:P625|P31}}', wd._property{'Property:P625','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=P625|P31}}', wd._property{eid='P625','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=Property:P625|P31}}', wd._property{eid='Property:P625','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|coord|P31}}', wd._property{'coord','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Property:coord|P31}}', wd._property{'Property:coord','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=coord|P31}}', wd._property{eid='coord','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=Property:coord|P31}}', wd._property{eid='Property:coord','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|invalid|P31}}', wd._property{'invalid','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Property:invalid|P31}}', wd._property{'Property:invalid','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=invalid|P31}}', wd._property{eid='invalid','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|eid=Property:invalid|P31}}', wd._property{eid='Property:invalid','P31'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|normal+|Q55|P1082}}', wd._property{'normal+','Q55','P1082'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|normal+|Q55|P1082}}', wd._properties{'normal+','Q55','P1082'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|normal+|Q55|P1082|P585}}', wd._properties{'qualifier','normal+','Q55','P1082','P585'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P1082}}', wd._property{'Q55','P1082'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P1082|punc=.}}', wd._property{'Q55','P1082',punc='.'})
	self:preprocess_equals('<ul>{{#invoke:wd/sandbox|properties|qualifier|normal+|Q55|P1082|P585|format=<li>%p[%r][<ul><li>%q</li></ul>]</li>}}</ul>', '<ul>' .. wd._properties{'qualifier','normal+','Q55','P1082','P585',format='<li>%p[%r][<ul><li>%q</li></ul>]</li>'} .. '</ul>')
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifier|normal+|Q55|P1082|P585}}', wd._qualifier{'normal+','Q55','P1082','P585'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifier|normal+|single|Q55|P1082|P585}}', wd._qualifier{'normal+','single','Q55','P1082','P585'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifier|Q55|P1082|16829289|P585}}', wd._qualifier{'Q55','P1082','16829289','P585'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifier|mdy|Q55|P1082|16829289|P585}}', wd._qualifier{'mdy','Q55','P1082','16829289','P585'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifier|raw|Q55|P1082|16829289|P585}}', wd._qualifier{'raw','Q55','P1082','16829289','P585'})
	self:preprocess_equals('{{#invoke:wd/sandbox|references|raw|Q55|P1082|16829289}}', wd._references{'raw','Q55','P1082','16829289'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|normal+|Q55|P1081}}', wd._properties{'normal+','Q55','P1081'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|normal+|sourced|Q55|P1081}}', wd._properties{'normal+','sourced','Q55','P1081'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifier|Q55|P2855|P518}}', wd._qualifier{'Q55','P2855','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifiers|Q55|P2855|P518}}', wd._qualifiers{'Q55','P2855','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|Q55|P2855|P518}}', wd._properties{'qualifiers','Q55','P2855','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|Q55|P2855|P518|sep=_+_|sep%s=|sep%q=_/_}}', wd._properties{'qualifiers','Q55','P2855','P518',sep='_+_',['sep%s']='',['sep%q']='_/_'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582}}', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|sep%q=_–_}}', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582',['sep%q']='_–_'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p[ <span style="font-size:85\\%">(%q1[ – %q2])</span>][%s][%r]}}', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582',format='%p[ <span style="font-size:85\\%">(%q1[ – %q2])</span>][%s][%r]'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p[ <span style="font-size:85\\%">([<![]--%q2]since [%q2--[]>]%q1[ – %q2])</span>][%s][%r]}}', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582',format='%p[ <span style="font-size:85\\%">([<![]--%q2]since [%q2--[]>]%q1[ – %q2])</span>][%s][%r]'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|raw|qualifier|normal+|Q55|P35|Q29574|P580|P582|format=%p[ <span style="font-size:85\\%">(%q1[ – %q2])</span>][%s][%r]}}', wd._properties{'qualifier','raw','qualifier','normal+','Q55','P35','Q29574','P580','P582',format='%p[ <span style="font-size:85\\%">(%q1[ – %q2])</span>][%s][%r]'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|normal+|current|Q55|P38|P518}}', wd._properties{'qualifiers','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|linked|qualifiers|normal+|current|Q55|P38|P518}}', wd._properties{'linked','qualifiers','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|linked|normal+|current|Q55|P38|P518}}', wd._properties{'qualifiers','linked','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|linked|short|qualifiers|linked|normal+|current|Q55|P38|P518}}', wd._properties{'linked','short','qualifiers','linked','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|qualifiers|normal+|current|Q55|P38|Q4917|P518}}', wd._qualifiers{'normal+','current','Q55','P38','Q4917','P518'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|normal+|current|Q55|P38|P518=Q27561}}', wd._properties{'normal+','current','Q55','P38',P518='Q27561'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|normal+|former|Q55|P38}}', wd._properties{'normal+','former','Q55','P38'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|raw|normal+|former|Q55|P38}}', wd._properties{'raw','normal+','former','Q55','P38'})
	self:preprocess_equals('{{#invoke:wd/sandbox|properties|raw|linked|normal+|former|Q55|P38}}', wd._properties{'raw','linked','normal+','former','Q55','P38'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P1549}}', wd._property{'Q55','P1549'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|multilanguage|Q55|P1549|P407=Q36846}}', wd._property{'multilanguage','Q55','P1549',P407='Q36846'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P2884}}', wd._property{'Q55','P2884'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|linked|Q55|P2884}}', wd._property{'linked','Q55','P2884'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|Q55|P2884}}', wd._property{'raw','Q55','P2884'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|unit|Q55|P2884}}', wd._property{'unit','Q55','P2884'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|unit|raw|Q55|P2884}}', wd._property{'unit','raw','Q55','P2884'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P625}}', wd._property{'Q55','P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|linked|Q55|P625}}', wd._property{'linked','Q55','P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|Q55|P625}}', wd._property{'raw','Q55','P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|coord}}', wd._property{'Q55','coord'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|linked|Q55|P41}}', wd._property{'linked','Q55','P41'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|Q55|P41}}', wd._property{'raw','Q55','P41'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|date=1700-05-06|Q55|P41}}', wd._property{'raw',date='1700-05-06','Q55','P41'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|date=1700-05-06|former|Q55|P41}}', wd._property{'raw',date='1700-05-06','former','Q55','P41'})
	self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|Q915684|P2534}}', wd._property{'raw','Q915684','P2534'})
	self:preprocess_equals('<ul>{{#invoke:wd/sandbox|properties|linked|qualifier|qualifier|raw|Q915684|P527|P416|P2534|format=<li>%p[ (%q)]</li>}}</ul>', '<ul>' .. wd._properties{'linked','qualifier','qualifier','raw','Q915684','P527','P416','P2534',format='<li>%p[ (%q)]</li>'} .. '</ul>')
	self:preprocess_equals('{{#invoke:wd/sandbox|property|linked|Q6256|P3896}}', wd._property{'linked','Q6256','P3896'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|Q4917}}', wd._label{'Q4917'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|short|linked|Q4917}}', wd._label{'short','linked','Q4917'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|P38}}', wd._label{'P38'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|linked|P38}}', wd._label{'linked','P38'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|Q776}}', wd._label{'Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|linked|Q776}}', wd._label{'linked','Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=Q776}}', wd._label{eid='Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|:' .. wdsb._title{'Q776'} .. '}}', wd._label{':' .. wd._title{'Q776'}})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|page=' .. wdsb._title{'Q776'} .. '}}', wd._label{page=wd._title{'Q776'}})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|page=:' .. wdsb._title{'Q776'} .. '}}', wd._label{page=':' .. wd._title{'Q776'}})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=Q776|Q2}}', wd._label{eid='Q776','Q2'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|page=' .. wdsb._title{'Q776'} .. '|Q2}}', wd._label{page=wd._title{'Q776'},'Q2'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|page=' .. wdsb._title{'Q776'} .. '|eid=Q2}}', wd._label{page=wd._title{'Q776'},eid='Q2'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label}}', wd._label{})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=}}', wd._label{eid=''})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw}}', wd._label{'raw'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|Q776}}', wd._label{'raw','Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|linked|Q776}}', wd._label{'raw','linked','Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|P625}}', wd._label{'P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|Property:P625}}', wd._label{'Property:P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=P625}}', wd._label{eid='P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=Property:P625}}', wd._label{eid='Property:P625'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|coord}}', wd._label{'coord'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|Property:coord}}', wd._label{'Property:coord'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=coord}}', wd._label{eid='coord'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=Property:coord}}', wd._label{eid='Property:coord'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|invalid}}', wd._label{'invalid'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|Property:invalid}}', wd._label{'Property:invalid'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=invalid}}', wd._label{eid='invalid'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|eid=Property:invalid}}', wd._label{eid='Property:invalid'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|Q6}}', wd._label{'raw','Q6'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|Q10000000000}}', wd._label{'raw','Q10000000000'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|P3}}', wd._label{'raw','P3'})
	self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|P10000000000}}', wd._label{'raw','P10000000000'})
	self:preprocess_equals('{{#invoke:wd/sandbox|title|Q776}}', wd._title{'Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|title|linked|Q776}}', wd._title{'linked','Q776'})
	self:preprocess_equals('{{#invoke:wd/sandbox|title}}', wd._title{})
	self:preprocess_equals('{{#invoke:wd/sandbox|description|Q55}}', wd._description{'Q55'})
	self:preprocess_equals('{{#invoke:wd/sandbox|description}}', wd._description{})
	self:preprocess_equals('{{#invoke:wd/sandbox|description|Q6}}', wd._description{'Q6'})
	self:preprocess_equals('{{#invoke:wd/sandbox|description|Q10000000000}}', wd._description{'Q10000000000'})
	self:preprocess_equals('{{#invoke:wd/sandbox|description|P3}}', wd._description{'P3'})
	self:preprocess_equals('{{#invoke:wd/sandbox|description|P10000000000}}', wd._description{'P10000000000'})
	self:preprocess_equals('{{#invoke:wd/sandbox|alias|Q55}}', wd._alias{'Q55'})
	self:preprocess_equals('{{#invoke:wd/sandbox|aliases|Q55}}', wd._aliases{'Q55'})
	self:preprocess_equals('{{#invoke:wd/sandbox|alias|linked|Q55}}', wd._alias{'linked','Q55'})
	self:preprocess_equals('{{#invoke:wd/sandbox|alias}}', wd._alias{})
	self:preprocess_equals('{{#invoke:wd/sandbox|badges|Q2}}', wd._badges{'Q2'})
	self:preprocess_equals('{{#invoke:wd/sandbox|badges|raw|Q2}}', wd._badges{'raw','Q2'})
	self:preprocess_equals('{{#invoke:wd/sandbox|badges}}', wd._badges{})
end

return p