--[[ 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}}', "")
end
--[[ temporarily disabled re other solution required
function p:only_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|only=wikidata}}', "")
end
function p:only_explicit__explicit_exists__wikidata_existstest__two_short_descriptions_numbered_after()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Wikipediayes|onlyname=Template:GetShortDescription/two explicit short descriptions numbered after}}', "FreeExplicit multilingual,short online,description numbered crowdsourcedsecond encyclopedia(used)")
end
function p:only_wikidata__explicit_exists__wikidata_existstest__two_short_descriptions_numbered_before()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Wikipediayes|onlyname=wikidataTemplate:GetShortDescription/two explicit short descriptions numbered before}}', "freeExplicit short description multilingualunnumbered onlinesecond encyclopedia(used)")
end
]]
function p:only_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Example|only=explicit}}', "")
end
function p:test__two_short_description_templates()
function p:only_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|onlyname=wikidataTemplate:GetShortDescription/two explicit short description templates}}', "WikimediaExplicit short description disambiguationsecond page(used)")
end
function p:test__two_short_description_templates__first_noreplace()
--[[ name and prefer ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/two explicit short description templates first noreplace}}', "Explicit short description second (used)")
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")
end
function p:test__two_short_description_templates__second_noreplace()
function p:prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/two explicit short description|prefer=wikidata templates second noreplace}}', "explicitExplicit short description first (used)")
end
function p:test__three_short_description_templates__second_noreplace()
function p:prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/nothree explicit short description|prefer=explicit templates second noreplace}}', "Explicit short description third (used)")
end
function p:test__three_short_description_templates__second_none__third_noreplace()
function p:prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred GandtGetShortDescription/sandbox/nothree explicit short description|prefer=wikidata templates second none third noreplace}}', "Explicit short description first (used)")
end
--[[ none but name ]]
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__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_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Wikipediayes|prefername=wikidataTemplate:GetShortDescription/no explicit short description}}', "free multilingual online encyclopedia")
end
function p:test__explicit_exists__wikidata_exists()
function p:prefer_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|prefername=explicitWikipedia}}', "WikimediaFree online disambiguationcrowdsourced pageencyclopedia")
end
function p:test__explicit_does_not_exist__wikidata_exists()
function p:prefer_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|prefername=wikidataExample}}', "Wikimedia disambiguation page")
end
--[[ name and fallbackonly ]]
function p:test__only_explicit__explicit_exists__wikidata_does_not_exist()
function p:fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|fallbackonly=fallbackexplicit}}', "explicitExplicit short description")
end
function p:test__only_wikidata__explicit_exists__wikidata_does_not_exist()
function p:fallback__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|fallbackonly=fallbackwikidata}}', "fallback")
end
function p:test__only_explicit__explicit_does_not_exist__wikidata_does_not_exist()
function p:fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/no explicit short description|fallbackonly=fallbackexplicit}}', "Free multilingual, online, crowdsourced encyclopedia")
end
function p:test__only_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
function p:fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=ExampleTemplate:GetShortDescription/no explicit short description|fallbackonly=fallbackwikidata}}', "Wikimedia disambiguation page")
end
function p:test__only_explicit__explicit_exists__wikidata_exists()
--[[ name, only and fallback ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|only=explicit}}', "Free online crowdsourced encyclopedia")
function p:only_explicit__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|only=explicit|fallback=fallback}}', "explicit short description")
end
function p:test__only_wikidata__explicit_exists__wikidata_exists()
function p:only_wikidata__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:Fred Gandt/sandbox/explicit short descriptionWikipedia|only=wikidata|fallback=fallback}}', "fallbackfree multilingual online encyclopedia")
end
function p:test__only_explicit__explicit_does_not_exist__wikidata_exists()
function p:only_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 descriptionExample|only=explicit|fallback=fallback}}', "fallback")
end
function p:test__only_wikidata__explicit_does_not_exist__wikidata_exists()
function p:only_wikidata__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 descriptionExample|only=wikidata|fallback=fallback}}', "fallbackWikimedia disambiguation page")
end
--[[ name and prefer ]]
function p:only_explicit__fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|only=explicit|fallback=fallback}}', "Free multilingual, online, crowdsourced encyclopedia")
function p:test__prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description|prefer=explicit}}', "Explicit short description")
end
function p:test__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
function p:only_wikidata__fallback__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Wikipediayes|onlyname=wikidataTemplate:GetShortDescription/explicit short description|fallbackprefer=fallbackwikidata}}', "free multilingualExplicit onlineshort encyclopediadescription")
end
function p:test__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
function p:only_explicit__fallback__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|onlyname=Template:GetShortDescription/no explicit short description|fallbackprefer=fallbackexplicit}}', "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_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|namestringify=Exampleyes|onlyname=wikidataTemplate:GetShortDescription/no explicit short description|fallbackprefer=fallbackwikidata}}', "Wikimedia disambiguation page")
end
function p:test__prefer_explicit__explicit_exists__wikidata_exists()
--[[ name, prefer and fallback ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|prefer=explicit}}', "Free online crowdsourced encyclopedia")
function p:prefer_explicit__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|prefer=explicit|fallback=fallback}}', "explicit short description")
end
function p:test__prefer_wikidata__explicit_exists__wikidata_exists()
function p:prefer_wikidata__fallback__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:Fred Gandt/sandbox/explicit short descriptionWikipedia|prefer=wikidata|fallback=fallback}}', "explicitfree multilingual shortonline descriptionencyclopedia")
end
function p:test__prefer_explicit__explicit_does_not_exist__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 descriptionExample|prefer=explicit|fallback=fallback}}', "fallbackWikimedia disambiguation page")
end
function p:test__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 explicit short descriptionExample|prefer=wikidata|fallback=fallback}}', "fallbackWikimedia disambiguation page")
end
--[[ conflicting params ]]
function p:prefer_explicit__fallback__explicit_exists__wikidata_exists()
--[[ only=explicit and prefer=wikidata ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|prefer=explicit|fallback=fallback}}', "Free multilingual, online, crowdsourced encyclopedia")
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description|only=explicit|prefer=wikidata}}', "Explicit 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_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=WikipediaTemplate:GetShortDescription/no explicit short description|preferonly=wikidataexplicit|fallbackprefer=fallbackwikidata}}', "free multilingual online encyclopedia")
end
function p:test__conflicting__only_explicit__prefer_wikidata__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=explicit|fallbackprefer=fallbackwikidata}}', "WikimediaFree online disambiguationcrowdsourced pageencyclopedia")
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_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example|preferonly=wikidataexplicit|fallbackprefer=fallbackwikidata}}', "Wikimedia disambiguation page")
end
--[[ conflictingonly=wikidata paramsand prefer=explicit ]]
--[[ only=explicit and prefer=wikidata ]]
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_does_not_exist()
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|only=explicitwikidata|prefer=wikidataexplicit}}', "explicit short description")
end
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
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 Gandt/sandboxGetShortDescription/no explicit short description|only=explicitwikidata|prefer=wikidataexplicit}}', "")
end
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_exists()
function p:conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|only=explicitwikidata|prefer=wikidataexplicit}}', "Freefree multilingual, online, crowdsourced encyclopedia")
end
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_exists()
function p:conflicting__only_explicit__prefer_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Example|only=explicitwikidata|prefer=wikidataexplicit}}', "Wikimedia disambiguation page")
end
--[[ only=wikidataunusual and prefer=explicit descriptions ]]
function p:test__only_explicit__undefined()
function p:conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description undefined|only=wikidata|prefer=explicit}}', "")
end
function p:test__only_explicit__empty()
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 GandtGetShortDescription/sandbox/no explicit short description empty|only=wikidata|prefer=explicit}}', "")
end
function p:test__only_explicit__none()
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 none|only=wikidata|prefer=explicit}}', "free multilingual online encyclopedianone")
end
function p:test__only_explicit__numbered()
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|only=wikidata|prefer=explicit}}', "WikimediaExplicit short disambiguationdescription pagenumbered")
end
function p:test__only_explicit__complex()
--[[ unusual explicit descriptions ]]
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Template:GetShortDescription/explicit short description complex|only=explicit}}', "Explicit short description complex")
end
function p:only_explicit__undefinedtest__only_explicit__complex__numbered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description undefinedcomplex numbered|only=explicit}}', "Explicit short description complex numbered")
end
function p:only_explicit__emptytest__only_explicit__numbered__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description numbered empty|only=explicit}}', "")
end
function p:only_explicit__whitespacetest__only_explicit__numbered__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description whitespacenumbered none|only=explicit}}', "none")
end
function p:only_explicit__nonetest__only_explicit__complex__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description nonecomplex empty|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
|