มอดูล: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('P395', wd._property{'Q55','P395'})
	self:preprocess_equals('P395', wd._property{'P395'})
	self:preprocess_equals('P395', wd._property{eid='Q55','P395'})
	self:preprocess_equals('P395', wd._property{eid=,'P395'})
	self:preprocess_equals(, wd._property{wd._title{'Q55'},'P395'})
	self:preprocess_equals(, wd._property{':' .. wd._title{'Q55'},'P395'})
	self:preprocess_equals(, wd._property{page=wd._title{'Q55'},'P395'})
	self:preprocess_equals(, wd._property{page=':' .. wd._title{'Q55'},'P395'})
	self:preprocess_equals('P395', wd._property{page=,'P395'})
	self:preprocess_equals('P395', wd._property{'edit','Q55','P395'})
	self:preprocess_equals('P395', wd._property{'edit@end','Q55','P395'})
	self:preprocess_equals('P31', wd._property{eid='Q55','Q2','P31'})
	self:preprocess_equals(, wd._property{page=wd._title{'Q55'},'Q2','P31'})
	self:preprocess_equals(, wd._property{page=wd._title{'Q55'},eid='Q2','P31'})
	self:preprocess_equals('P31', wd._property{'P625','P31'})
	self:preprocess_equals('P31', wd._property{'Property:P625','P31'})
	self:preprocess_equals('P31', wd._property{eid='P625','P31'})
	self:preprocess_equals('P31', wd._property{eid='Property:P625','P31'})
	self:preprocess_equals('P31', wd._property{'coord','P31'})
	self:preprocess_equals('P31', wd._property{'Property:coord','P31'})
	self:preprocess_equals('P31', wd._property{eid='coord','P31'})
	self:preprocess_equals('P31', wd._property{eid='Property:coord','P31'})
	self:preprocess_equals('P31', wd._property{'invalid','P31'})
	self:preprocess_equals('P31', wd._property{'Property:invalid','P31'})
	self:preprocess_equals('P31', wd._property{eid='invalid','P31'})
	self:preprocess_equals('P31', wd._property{eid='Property:invalid','P31'})
	self:preprocess_equals('P1082', wd._property{'normal+','Q55','P1082'})
	self:preprocess_equals('P1082', wd._properties{'normal+','Q55','P1082'})
	self:preprocess_equals('P585', wd._properties{'qualifier','normal+','Q55','P1082','P585'})
	self:preprocess_equals('P1082', wd._property{'Q55','P1082'})
	self:preprocess_equals('punc=.', wd._property{'Q55','P1082',punc='.'})
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|normal+|Q55|P1082|P585|format=%p%r%q',  .. wd._properties{'qualifier','normal+','Q55','P1082','P585',format='%p%r%q'} .. )
	self:preprocess_equals('P585', wd._qualifier{'normal+','Q55','P1082','P585'})
	self:preprocess_equals('P585', wd._qualifier{'normal+','single','Q55','P1082','P585'})
	self:preprocess_equals('P585', wd._qualifier{'Q55','P1082','16829289','P585'})
	self:preprocess_equals('P585', wd._qualifier{'mdy','Q55','P1082','16829289','P585'})
	self:preprocess_equals('P585', wd._qualifier{'raw','Q55','P1082','16829289','P585'})
	self:preprocess_equals('16829289', wd._references{'raw','Q55','P1082','16829289'})
	self:preprocess_equals('P1081', wd._properties{'normal+','Q55','P1081'})
	self:preprocess_equals('P1081', wd._properties{'normal+','sourced','Q55','P1081'})
	self:preprocess_equals('P518', wd._qualifier{'Q55','P2855','P518'})
	self:preprocess_equals('P518', wd._qualifiers{'Q55','P2855','P518'})
	self:preprocess_equals('P518', wd._properties{'qualifiers','Q55','P2855','P518'})
	self:preprocess_equals('sep%q=_/_', wd._properties{'qualifiers','Q55','P2855','P518',sep='_+_','sep%s'=,'sep%q'='_/_'})
	self:preprocess_equals('P582', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582'})
	self:preprocess_equals('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 (%q1 – %q2)%s%r', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582',format='%p (%q1 – %q2)%s%r'})
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p (%q1 – %q2)%s%r', wd._properties{'qualifier','qualifier','normal+','Q55','P35','P580','P582',format='%p (%q1 – %q2)%s%r'})
	self:preprocess_equals('#invoke:wd/sandbox|properties|qualifier|raw|qualifier|normal+|Q55|P35|Q29574|P580|P582|format=%p (%q1 – %q2)%s%r', wd._properties{'qualifier','raw','qualifier','normal+','Q55','P35','Q29574','P580','P582',format='%p (%q1 – %q2)%s%r'})
	self:preprocess_equals('P518', wd._properties{'qualifiers','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('P518', wd._properties{'linked','qualifiers','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('P518', wd._properties{'qualifiers','linked','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('P518', wd._properties{'linked','short','qualifiers','linked','normal+','current','Q55','P38','P518'})
	self:preprocess_equals('P518', wd._qualifiers{'normal+','current','Q55','P38','Q4917','P518'})
	self:preprocess_equals('P518=Q27561', wd._properties{'normal+','current','Q55','P38',P518='Q27561'})
	self:preprocess_equals('P38', wd._properties{'normal+','former','Q55','P38'})
	self:preprocess_equals('P38', wd._properties{'raw','normal+','former','Q55','P38'})
	self:preprocess_equals('P38', wd._properties{'raw','linked','normal+','former','Q55','P38'})
	self:preprocess_equals('P1549', wd._property{'Q55','P1549'})
	self:preprocess_equals('P407=Q36846', wd._property{'multilanguage','Q55','P1549',P407='Q36846'})
	self:preprocess_equals('P2884', wd._property{'Q55','P2884'})
	self:preprocess_equals('P2884', wd._property{'linked','Q55','P2884'})
	self:preprocess_equals('P2884', wd._property{'raw','Q55','P2884'})
	self:preprocess_equals('P2884', wd._property{'unit','Q55','P2884'})
	self:preprocess_equals('P2884', wd._property{'unit','raw','Q55','P2884'})
	self:preprocess_equals('P625', wd._property{'Q55','P625'})
	self:preprocess_equals('P625', wd._property{'linked','Q55','P625'})
	self:preprocess_equals('P625', wd._property{'raw','Q55','P625'})
	self:preprocess_equals('coord', wd._property{'Q55','coord'})
	self:preprocess_equals('P41', wd._property{'linked','Q55','P41'})
	self:preprocess_equals('P41', wd._property{'raw','Q55','P41'})
	self:preprocess_equals('P41', wd._property{'raw',date='1700-05-06','Q55','P41'})
	self:preprocess_equals('P41', wd._property{'raw',date='1700-05-06','former','Q55','P41'})
	self:preprocess_equals('P2534', wd._property{'raw','Q915684','P2534'})
	self:preprocess_equals('#invoke:wd/sandbox|properties|linked|qualifier|qualifier|raw|Q915684|P527|P416|P2534|format=%p (%q)',  .. wd._properties{'linked','qualifier','qualifier','raw','Q915684','P527','P416','P2534',format='%p (%q)'} .. )
	self:preprocess_equals('P3896', wd._property{'linked','Q6256','P3896'})
	self:preprocess_equals('Q4917', wd._label{'Q4917'})
	self:preprocess_equals('Q4917', wd._label{'short','linked','Q4917'})
	self:preprocess_equals('P38', wd._label{'P38'})
	self:preprocess_equals('P38', wd._label{'linked','P38'})
	self:preprocess_equals('Q776', wd._label{'Q776'})
	self:preprocess_equals('Q776', wd._label{'linked','Q776'})
	self:preprocess_equals('eid=Q776', wd._label{eid='Q776'})
	self:preprocess_equals(, wd._label{':' .. wd._title{'Q776'}})
	self:preprocess_equals(, wd._label{page=wd._title{'Q776'}})
	self:preprocess_equals(, wd._label{page=':' .. wd._title{'Q776'}})
	self:preprocess_equals('Q2', wd._label{eid='Q776','Q2'})
	self:preprocess_equals(, wd._label{page=wd._title{'Q776'},'Q2'})
	self:preprocess_equals(, wd._label{page=wd._title{'Q776'},eid='Q2'})
	self:preprocess_equals('label', wd._label{})
	self:preprocess_equals('eid=', wd._label{eid=})
	self:preprocess_equals('raw', wd._label{'raw'})
	self:preprocess_equals('Q776', wd._label{'raw','Q776'})
	self:preprocess_equals('Q776', wd._label{'raw','linked','Q776'})
	self:preprocess_equals('P625', wd._label{'P625'})
	self:preprocess_equals('Property:P625', wd._label{'Property:P625'})
	self:preprocess_equals('eid=P625', wd._label{eid='P625'})
	self:preprocess_equals('eid=Property:P625', wd._label{eid='Property:P625'})
	self:preprocess_equals('coord', wd._label{'coord'})
	self:preprocess_equals('Property:coord', wd._label{'Property:coord'})
	self:preprocess_equals('eid=coord', wd._label{eid='coord'})
	self:preprocess_equals('eid=Property:coord', wd._label{eid='Property:coord'})
	self:preprocess_equals('invalid', wd._label{'invalid'})
	self:preprocess_equals('Property:invalid', wd._label{'Property:invalid'})
	self:preprocess_equals('eid=invalid', wd._label{eid='invalid'})
	self:preprocess_equals('eid=Property:invalid', wd._label{eid='Property:invalid'})
	self:preprocess_equals('Q6', wd._label{'raw','Q6'})
	self:preprocess_equals('Q10000000000', wd._label{'raw','Q10000000000'})
	self:preprocess_equals('P3', wd._label{'raw','P3'})
	self:preprocess_equals('P10000000000', wd._label{'raw','P10000000000'})
	self:preprocess_equals('Q776', wd._title{'Q776'})
	self:preprocess_equals('Q776', wd._title{'linked','Q776'})
	self:preprocess_equals('title', wd._title{})
	self:preprocess_equals('Q55', wd._description{'Q55'})
	self:preprocess_equals('description', wd._description{})
	self:preprocess_equals('Q6', wd._description{'Q6'})
	self:preprocess_equals('Q10000000000', wd._description{'Q10000000000'})
	self:preprocess_equals('P3', wd._description{'P3'})
	self:preprocess_equals('P10000000000', wd._description{'P10000000000'})
	self:preprocess_equals('Q55', wd._alias{'Q55'})
	self:preprocess_equals('Q55', wd._aliases{'Q55'})
	self:preprocess_equals('Q55', wd._alias{'linked','Q55'})
	self:preprocess_equals('alias', wd._alias{})
	self:preprocess_equals('Q2', wd._badges{'Q2'})
	self:preprocess_equals('Q2', wd._badges{'raw','Q2'})
	self:preprocess_equals('badges', wd._badges{})
end
return p