Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Wd/sandbox/testcases/testcaseTable

From Wikipedia, the free encyclopedia
-- work in progress
-- This is going to contain centralized testcases, which are currently triplicated.

-- dependencies used for generating expected outputs 
local wdib = require("Module:WikidataIB")
local wd = require("Module:Wd")  -- temporary, should be converted to wdib

return {
    -- structure: tables, which contain test inputs for the module and corresponding correct outputs
    -- and, optionally, a boolean indicating if the testcase is to be inclosed in <ul> and </ul>
    {"label|raw|page=Crosslauf-Europameisterschaften 2009|globalSiteId=dewiki", "Q1141358"},

    -- These testcases were copied from the old testcase files (Module:wd/testcases/[1, 2, 3]).
	-- In the previous version, all testcases with the "format" parameter lacked it when comparing outputs of sandbox against the main module (Module:wd/testcases/3).
	{"property|Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|P395", ""},
	{"property|eid=Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|eid=|P395", ""},
	{"property|" .. wd._title{"Q55"} .. "|P395", ""},
	{"property|:" .. wd._title{"Q55"} .. "|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|page=" .. wd._title{"Q55"} .. "|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|page=:" .. wd._title{"Q55"} .. "|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|page=|P395", ""},
	{"property|edit|Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"} .. "&nbsp;[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q55?uselang=en#P395|Edit this on Wikidata]]"},
	{"property|edit@end|Q55|P395", wdib._getValue{"P395",qid="Q55",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"} .. "<span style=\"float:right\">[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q55?uselang=en#P395|Edit this on Wikidata]]</span>"},
	{"property|eid=Q55|Q2|P31", wdib._getValue{"P31",qid="Q2",linked="false",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|page=" .. wd._title{"Q55"} .. "|Q2|P31", wdib._getValue{"P31",qid="Q2",linked="false",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{"property|page=" .. wd._title{"Q55"} .. "|eid=Q2|P31", wdib._getValue{"P31",qid="Q2",linked="false",noicon="true",osd="no",rank="best",maxvals="1",fwd="ALL"}},
	{'property|P625|P31', ''},
	{'property|Property:P625|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|eid=P625|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|eid=Property:P625|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|coord|P31', ''},
	{'property|Property:coord|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|eid=coord|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|eid=Property:coord|P31', wdib._getValue{'P31',qid='P625',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|invalid|P31', ''},
	{'property|Property:invalid|P31', ''},
	{'property|eid=invalid|P31', ''},
	{'property|eid=Property:invalid|P31', ''},
	{'property|normal+|Q55|P1082', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'properties|normal+|Q55|P1082', table.concat({wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', ')},
	{'properties|qualifier|normal+|Q55|P1082|P585|format=%p[ (%q)][%s][%r]', table.concat({wdib._getValue{'P1082',qid='Q55',qual='P585',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, wdib._getValue{'P1082',qid='Q55',qual='P585',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}}, ', ')},
	{'property|Q55|P1082', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}},
	{'property|Q55|P1082|punc=.', wdib._getValue{'P1082',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}..'.'},
	-- this testcase was originally present only in Module:wd/testcases/3
	{'properties|qualifier|normal+|Q55|P1082|P585|format=<li>%p[%r][<ul><li>%q</li></ul>]</li>', '', true},
}