--[[ empty params ]]
function p:no_name_paramtest__no_name_param()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes}}', "ERROR with invocation of'<span style="color:#d33">[[Module:GetShortDescription:]] requires a page name (including namespace).</span>[[Category:Pages MUSTdisplaying bealarming provided"messages about Module:GetShortDescription]]', {nowiki = 1})
end
function p:no_name_valuetest__no_name_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=}}', "ERROR with invocation of'<span style="color:#d33">[[Module:GetShortDescription:]] requires a page name (including namespace).</span>[[Category:Pages MUSTdisplaying bealarming provided"messages about Module:GetShortDescription]]', {nowiki = 1})
end
function p:no_only_valuetest__no_only_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=}}', "explicitExplicit short description")
end
function p:no_prefer_valuetest__no_prefer_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|prefer=}}', "explicitExplicit short description")
end
function p:no_fallback_valuetest__no_objectify_alarm_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=User:Fred Gandt/sandbox/no explicit short descriptionyes|fallbackobjectify_alarm=}}', '<span style="color:#d33">[[Module:GetShortDescription]] requires a page name (including namespace).</span>[[Category:Pages displaying alarming messages about Module:GetShortDescription]]', {nowiki = 1})
end
--[[ nonenonexistent butpage name ]]
function p:explicit_exists__wikidata_does_not_existtest__nonexistent_page_name()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:FredIntentionally Gandt/sandbox/explicitpermanent shortred descriptionlink}}', "explicit short description"'')
end
--[[ unknown param offered ]]
function p:explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description}}', "")
end
function p:explicit_exists__wikidata_existstest__unknown_param_with_no_value_offered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/explicit short description|unknown=}}', "Free multilingual, online,Explicit crowdsourcedshort encyclopediadescription")
end
function p:explicit_does_not_exist__wikidata_existstest__unknown_param_with_value_offered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=ExampleTemplate:GetShortDescription/explicit short description|unknown=unknown}}', "WikimediaExplicit disambiguationshort pagedescription")
end
--[[ nameunknown andparam onlyfound ]]
function p:test__unknown_param_found()
function p:only_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=explicit with unknown params}}', "explicitExplicit short description with unknown params")
end
function p:test__complex_unknown_params_found()
function p:only_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=wikidata with complex unknown params}}', "Explicit short description with complex unknown params")
end
--[[ multiple short descriptions ]]
function p:only_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|only=explicit}}', "")
--[[ temporarily disabled re other solution required
function p:test__two_short_descriptions_numbered_after()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/two explicit short descriptions numbered after}}', "Explicit short description numbered second (used)")
end
function p:test__two_short_descriptions_numbered_before()
function p:only_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred GandtGetShortDescription/sandbox/notwo explicit short description|only=wikidatadescriptions numbered before}}', "Explicit short description unnumbered second (used)")
end
]]
function p:only_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|only=explicit}}', "Free multilingual, online, crowdsourced encyclopedia")
function p:test__two_short_description_templates()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/two explicit short description templates}}', "Explicit short description second (used)")
end
function p:test__two_short_description_templates__first_noreplace()
function p:only_wikidata__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Wikipediayes|onlyname=wikidataTemplate:GetShortDescription/two explicit short description templates first noreplace}}', "freeExplicit short multilingualdescription onlinesecond encyclopedia(used)")
end
function p:test__two_short_description_templates__second_noreplace()
function p:only_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|onlyname=Template:GetShortDescription/two explicit short description templates second noreplace}}', "Explicit short description first (used)")
end
function p:test__three_short_description_templates__second_noreplace()
function p:only_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|onlyname=wikidataTemplate:GetShortDescription/three explicit short description templates second noreplace}}', "WikimediaExplicit short description disambiguationthird page(used)")
end
function p:test__three_short_description_templates__second_none__third_noreplace()
--[[ name and prefer ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/three explicit short description templates second none third noreplace}}', "Explicit short description first (used)")
end
--[[ none but name ]]
function p:prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|prefer=explicit}}', "explicit short description")
function p:test__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description}}', "Explicit short description")
end
function p:test__explicit_does_not_exist__wikidata_does_not_exist()
function p:prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:FredGetShortDescription/no Gandt/sandbox/explicit short description|prefer=wikidata}}', "explicit short description")
end
function p:test__explicit_exists__wikidata_exists()
function p:prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=User:Fred Gandt/sandbox/no explicit short descriptionyes|prefername=explicitWikipedia}}', "Free online crowdsourced encyclopedia")
end
function p:test__explicit_does_not_exist__wikidata_exists()
function p:prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=User:Fred Gandt/sandbox/no explicit short descriptionyes|prefername=wikidataExample}}', "Wikimedia disambiguation page")
end
--[[ name and only ]]
function p:prefer_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|prefer=explicit}}', "Free multilingual, online, crowdsourced encyclopedia")
function p:test__only_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description|only=explicit}}', "Explicit short description")
end
function p:test__only_wikidata__explicit_exists__wikidata_does_not_exist()
function p:prefer_wikidata__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/explicit short description|preferonly=wikidata}}', "free multilingual online encyclopedia")
end
function p:test__only_explicit__explicit_does_not_exist__wikidata_does_not_exist()
function p:prefer_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=ExampleTemplate:GetShortDescription/no explicit short description|preferonly=explicit}}', "Wikimedia disambiguation page")
end
function p:test__only_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
function p:prefer_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=ExampleTemplate:GetShortDescription/no explicit short description|preferonly=wikidata}}', "Wikimedia disambiguation page")
end
function p:test__only_explicit__explicit_exists__wikidata_exists()
--[[ name and fallback ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|only=explicit}}', "Free online crowdsourced encyclopedia")
function p:fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|fallback=fallback}}', "explicit short description")
end
function p:test__only_wikidata__explicit_exists__wikidata_exists()
function p:fallback__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:Fred Gandt/sandbox/no explicit short descriptionWikipedia|fallbackonly=fallbackwikidata}}', "fallbackfree multilingual online encyclopedia")
end
function p:test__only_explicit__explicit_does_not_exist__wikidata_exists()
function p:fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaExample|fallbackonly=fallbackexplicit}}', "Free multilingual, online, crowdsourced encyclopedia")
end
function p:test__only_wikidata__explicit_does_not_exist__wikidata_exists()
function p:fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example|fallbackonly=fallbackwikidata}}', "Wikimedia disambiguation page")
end
--[[ name, only and fallbackprefer ]]
function p:test__prefer_explicit__explicit_exists__wikidata_does_not_exist()
function p:only_explicit__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|onlyprefer=explicit|fallback=fallback}}', "explicitExplicit short description")
end
function p:test__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
function p:only_wikidata__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|onlyprefer=wikidata|fallback=fallback}}', "fallbackExplicit short description")
end
function p:test__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
function p:only_explicit__fallback__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|onlyprefer=explicit|fallback=fallback}}', "fallback")
end
function p:test__prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
function p:only_wikidata__fallback__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|onlyprefer=wikidata|fallback=fallback}}', "fallback")
end
function p:test__prefer_explicit__explicit_exists__wikidata_exists()
function p:only_explicit__fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|onlyprefer=explicit|fallback=fallback}}', "Free multilingual, online, crowdsourced encyclopedia")
end
function p:test__prefer_wikidata__explicit_exists__wikidata_exists()
function p:only_wikidata__fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|onlyprefer=wikidata|fallback=fallback}}', "free multilingual online encyclopedia")
end
function p:test__prefer_explicit__explicit_does_not_exist__wikidata_exists()
function p:only_explicit__fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example|onlyprefer=explicit|fallback=fallback}}', "fallbackWikimedia disambiguation page")
end
function p:test__prefer_wikidata__explicit_does_not_exist__wikidata_exists()
function p:only_wikidata__fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example|onlyprefer=wikidata|fallback=fallback}}', "Wikimedia disambiguation page")
end
--[[ name,conflicting prefer and fallbackparams ]]
--[[ only=explicit and prefer=wikidata ]]
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
function p:prefer_explicit__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|preferonly=explicit|fallbackprefer=fallbackwikidata}}', "explicitExplicit short description")
end
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
function p:prefer_wikidata__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:FredGetShortDescription/no Gandt/sandbox/explicit short description|only=explicit|prefer=wikidata|fallback=fallback}}', "explicit short description")
end
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_exists()
function p:prefer_explicit__fallback__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:Fred Gandt/sandbox/no explicit short descriptionWikipedia|preferonly=explicit|fallbackprefer=fallbackwikidata}}', "fallbackFree online crowdsourced encyclopedia")
end
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_does_not_exist__wikidata_exists()
function p:prefer_wikidata__fallback__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:Fred Gandt/sandbox/no Example|only=explicit short description|prefer=wikidata|fallback=fallback}}', "fallback")
end
--[[ only=wikidata and prefer=explicit ]]
function p:prefer_explicit__fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|prefer=explicit|fallback=fallback}}', "Free multilingual, online, crowdsourced encyclopedia")
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description|only=wikidata|prefer=explicit}}', "")
end
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
function p:prefer_wikidata__fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/no explicit short description|preferonly=wikidata|fallbackprefer=fallbackexplicit}}', "free multilingual online encyclopedia")
end
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_exists()
function p:prefer_explicit__fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=ExampleWikipedia|preferonly=explicitwikidata|fallbackprefer=fallbackexplicit}}', "Wikimediafree multilingual disambiguationonline pageencyclopedia")
end
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_exists()
function p:prefer_wikidata__fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example|preferonly=wikidata|fallbackprefer=fallbackexplicit}}', "Wikimedia disambiguation page")
end
--[[ conflictingunusual paramsexplicit descriptions ]]
--[[ only=explicit and prefer=wikidata ]]
function p:test__only_explicit__undefined()
function p:conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description undefined|only=explicit|prefer=wikidata}}', "explicit short description")
end
function p:test__only_explicit__empty()
function p:conflicting__only_explicit__prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred GandtGetShortDescription/sandbox/no explicit short description empty|only=explicit|prefer=wikidata}}', "")
end
function p:test__only_explicit__none()
function p:conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/explicit short description none|only=explicit|prefer=wikidata}}', "Free multilingual, online, crowdsourced encyclopedianone")
end
function p:test__only_explicit__numbered()
function p:conflicting__only_explicit__prefer_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|onlyname=Template:GetShortDescription/explicit short description numbered|preferonly=wikidataexplicit}}', "Explicit short description numbered")
end
function p:test__only_explicit__complex()
--[[ only=wikidata and prefer=explicit ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description complex|only=explicit}}', "Explicit short description complex")
function p:conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|only=wikidata|prefer=explicit}}', "")
end
function p:test__only_explicit__complex__numbered()
function p:conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description complex numbered|only=wikidata|prefer=explicit}}', "Explicit short description complex numbered")
end
function p:test__only_explicit__numbered__empty()
function p:conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/explicit short description numbered empty|only=wikidata|prefer=explicit}}', "free multilingual online encyclopedia")
end
function p:test__only_explicit__numbered__none()
function p:conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=ExampleTemplate:GetShortDescription/explicit short description numbered none|only=wikidata|prefer=explicit}}', "Wikimedia disambiguation pagenone")
end
function p:test__only_explicit__complex__empty()
--[[ unusual explicit descriptions ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description complex empty|only=explicit}}', "")
function p:only_explicit__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description none|only=explicit}}', "")
end
function p:only_explicit__complextest__only_explicit__complex__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex none|only=explicit}}', "explicit short description complexnone")
end
function p:only_explicit__numberedtest__only_explicit__complex__numbered__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex numbered empty|only=explicit}}', "explicit short description numbered")
end
function p:only_explicit__complex__numberedtest__only_explicit__complex__numbered__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandbox/User:Fred Gandt/sandboxGetShortDescription/explicit short description complex numbered none|only=explicit}}', "explicit short description complex numberednone")
end
--[[ test the test; sanity check; should fail ]]
--function p:test_the_testtest__the_test()
-- self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example}}', "test the test")
--end
|