-- Unit tests for [[Module:AnnotatedLinkAnnotated link]]. Run all tests on the talk page.
-- Due to the changable nature of short descriptions; some of these tests may need to be updated before running them.
--[[ empty params ]]
function p:no_name_paramtest__no_name_param()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main}}', "ERROR with invocation of'<span Modulestyle="color:AnnotatedLink#d33">[[Module:Annotated link]] requires a page name (including namespace).</span>[[Category:Pages MUSTdisplaying bealarming provided"messages about Module:Annotated link]]', { nowiki = 1 })
end
function p:no_name_valuetest__no_name_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|name=}}', "ERROR with invocation of'<span style="color:#d33">[[Module:AnnotatedLink:Annotated link]] requires a page name (including namespace).</span>[[Category:Pages MUSTdisplaying bealarming provided"messages about Module:Annotated link]]', { nowiki = 1 })
end
function p:no_display_valuetest__no_display_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|display=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_quote_valuetest__no_quote_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|quote=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_abbr_valuetest__no_abbr_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_abbr_value__abbr_titletest__no_abbr_value__abbr_title()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=|abbr_title=Abbreviation}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_abbr__no_abbr_title_valuetest__no_abbr__no_abbr_title_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=|abbr_title=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_aka_valuetest__no_aka_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|aka=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_wedge_valuetest__no_wedge_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|wedge=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_dash_valuetest__no_dash_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|dash=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_desc_first_letter_case_valuetest__no_desc_first_letter_case_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|desc_first_letter_case=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_link_lang_valuetest__no_link_lang_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|link_lang=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
-- tests for empty |link_lang_italic= |link_lang_nocat= |link_lang_size= |link_lang_cat= |link_lang_rtl= ?
function p:no_aka_lang_valuetest__no_aka_lang_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|aka_lang=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
-- tests for empty |aka_lang_italic= |aka_lang_nocat= |aka_lang_size= |aka_lang_cat= |aka_lang_rtl= ?
function p:no_wedge_lang_valuetest__no_wedge_lang_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|wedge_lang=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
-- tests for empty |wedge_lang_italic= |wedge_lang_nocat= |wedge_lang_size= |wedge_lang_cat= |wedge_lang_rtl= ?
function p:no_only_valuetest__no_only_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_prefer_valuetest__no_prefer_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|prefer=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:no_fallback_valuetest__no_fallback_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|fallback=}}', "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]]")
end
--[[ nonexistent page name ]]
function p:test__nonexistent_page_name()
self:preprocess_equals('{{#invoke:Annotated link|main|name=Intentionally permanent red link}}', '[[:Intentionally permanent red link|Intentionally permanent red link]]')
end
--[[ unknown param ]]
function p:no_unknown_valuetest__no_unknown_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|unknown=}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:unknown_valuetest__unknown_value()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|unknown=unknown}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
--[[ none but name ]]
function p:short_description_existstest__short_description_exists()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description}}', "User[[:Fred Gandt/sandboxTemplate:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – explicitExplicit short description")
end
function p:short_description_does_not_existtest__short_description_does_not_exist()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description}}', "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]]")
end
--[[ template links ]]
function p:test__template_link__only_explicit()
self:preprocess_equals('{{#invoke:Annotated link|main|name=Template:Annotated link|only=explicit}}', "{{[[:Template:Annotated link|Annotated link]]}}")
end
function p:test__template_link_code__only_explicit()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=code|name=Template:annotated link|only=explicit}}', "<code>{{[[:Template:annotated link|annotated link]]}}</code>", {combine = 1})
end
function p:test__template_link_no__only_explicit()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:Annotated link|only=explicit}}', "[[:Template:Annotated link|Template:Annotated link]]")
end
function p:test__template_link_no__display__only_explicit()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:Annotated link|display=Annotated link|only=explicit}}', "[[:Template:Annotated link|Annotated link]]")
end
--[[ name and display ]]
function p:display__short_description_existstest__display__short_description_exists()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|display=Test page}}', "[[:Template:GetShortDescription/explicit short description|Test page ]] – explicitExplicit short description")
end
function p:display__short_description_does_not_existtest__display__short_description_does_not_exist()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|display=Test page}}', "[[:Template:GetShortDescription/no explicit short description|Test page]]")
end
--[[ name and quote ]]
function p:quote__short_description_existstest__quote__short_description_exists()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|quote=yes}}', '"User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]]" – explicitExplicit short description')
end
function p:quote__short_description_does_not_existtest__quote__short_description_does_not_exist()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|quote=yes}}', '"User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]]"')
end
--[[ name and abbr ]]
function p:abbr__short_description_existstest__abbr__short_description_exists()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=ESD}}', 'User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]] (<abbr>ESD</abbr>) – explicitExplicit short description', { combined = 1 })
end
function p:abbr__short_description_does_not_existtest__abbr__short_description_does_not_exist()
self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|abbr=ESDNESD}}', 'User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]] (<abbr>NESD</abbr>)', { combined = 1 })
end
--[[ name, abbr and abbr_title ]]
function p:test__abbr__abbr_title__short_description_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|abbr=ESD|abbr_title=Explicit Short Description}}', '[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] (<abbr title="Explicit Short Description">ESD</abbr>) – Explicit short description', { combined = 1 })
end
function p:test__abbr__abbr_title__short_description_does_not_exist()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|abbr=NESD|abbr_title=No Explicit Short Description}}', '[[:Template:GetShortDescription/no explicit short description|Template:GetShortDescription/no explicit short description]] (<abbr title="No Explicit Short Description">NESD</abbr>)', { combined = 1 })
end
--[[ name and aka ]]
function p:aka__short_description_existstest__aka__short_description_exists()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|aka=Fred's test page}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]], also known as Fred's test page – explicitExplicit short description")
end
function p:aka__short_description_does_not_existtest__aka__short_description_does_not_exist()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|aka=Fred's test page}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]], also known as Fred's test page")
end
--[[ name and wedge ]]
function p:wedge__short_description_existstest__wedge__short_description_exists()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]], [[Tight Fit ]] – explicitExplicit short description")
end
function p:wedge__short_description_does_not_existtest__wedge__short_description_does_not_exist()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]], [[Tight Fit]]")
end
--[[ name, abbr and aka ]]
function p:abbr__aka__short_description_existstest__abbr__aka__short_description_exists()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=ESD|aka=Fred's test page}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]] (<abbr>ESD</abbr>), also known as Fred's test page – explicitExplicit short description", { combined = 1 })
end
function p:abbr__aka__short_description_does_not_existtest__abbr__aka__short_description_does_not_exist()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|abbr=NESD|aka=Fred's test page}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]] (ESD<abbr>NESD</abbr>), also known as Fred's test page", { combined = 1 })
end
--[[ name, abbr and wedge ]]
function p:abbr__wedge__short_description_existstest__abbr__wedge__short_description_exists()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=ESD|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]] (<abbr>ESD</abbr>), [[Tight Fit ]] – explicitExplicit short description", { combined = 1 })
end
function p:abbr__wedge__short_description_does_not_existtest__abbr__wedge__short_description_does_not_exist()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|abbr=NESD|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]] (<abbr>NESD</abbr>), [[Tight Fit]]", { combined = 1 })
end
--[[ name, abbr, aka and wedge ]]
function p:abbr__aka__wedge__short_description_existstest__abbr__aka__wedge__short_description_exists()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|abbr=ESD|aka=Fred's test page|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]] (<abbr>ESD</abbr>), also known as Fred's test page, [[Tight Fit ]] – explicitExplicit short description", { combined = 1 })
end
function p:test__abbr__aka__wedge__short_description_does_not_exist()
function p:abbr__aka__wedge__short_description_does_not_exist()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|abbr=NESD|aka=Fred's test page|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxno explicit short description|Template:GetShortDescription/no explicit short description]] (<abbr>NESD</abbr>), also known as Fred's test page, [[Tight Fit]]", { combined = 1 })
end
--[[ name, aka and wedge ]]
function p:aka__wedge__short_description_existstest__aka__wedge__short_description_exists()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|aka=Fred's test page|wedge=[[Tight Fit]]}}", "User[[:Fred GandtTemplate:GetShortDescription/sandboxexplicit short description|Template:GetShortDescription/explicit short description]], also known as Fred's test page, [[Tight Fit ]] – explicitExplicit short description")
end
function p:aka__wedge__short_description_does_not_existtest__aka__wedge__short_description_does_not_exist()
self:preprocess_equals("{{#invoke:AnnotatedLinkAnnotated link|main|template_link=no|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|aka=Fred's test page|wedge=[[Tight Fit]]}}", "User[[:FredTemplate:GetShortDescription/no Gandt/sandboxexplicit short description|Template:GetShortDescription/no explicit short description]], also known as Fred's test page, [[Tight Fit]]")
end
--[[ name and link_lang en ]]
function p:test__link_lang_en()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|link_lang=en}}', "[[:Template:GetShortDescription/no explicit short description|Template:GetShortDescription/no explicit short description]]")
end
--[[ name, display and link_lang fr ]]
--[[
function p:test__display__link_lang_fr()
|name= |display= |quote= |abbr= |abbr_title= |aka= |wedge= |dash= |desc_first_letter_case=
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|display=La page de test de Fred|link_lang=fr}}', '<span title="French-language text"><i lang="fr">[[:Template:GetShortDescription/no explicit short description|La page de test de Fred]]</i></span>', { combined = 1 })
end
--[[ name, display, quote and link_lang fr ]]
|link_lang= |link_lang_italic= |link_lang_nocat= |link_lang_size= |link_lang_cat= |link_lang_rtl=
function p:test__display__quote__link_lang_fr()
|aka_lang= |aka_lang_italic= |aka_lang_nocat= |aka_lang_size= |aka_lang_cat= |aka_lang_rtl=
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|display=La page de test de Fred|quote=yes|link_lang=fr}}', '"<span title="French-language text"><i lang="fr">[[:Template:GetShortDescription/no explicit short description|La page de test de Fred]]</i></span>"', { combined = 1 })
end
--[[ name, aka and aka_lang ja ]]
|wedge_lang= |wedge_lang_italic= |wedge_lang_nocat= |wedge_lang_size= |wedge_lang_cat= |wedge_lang_rtl=
function p:test__aka__aka_lang_ja()
|only= |prefer= |fallback=
self:preprocess_equals("{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|aka=フレッドのテストページ|aka_lang=ja}}", '[[:Template:GetShortDescription/no explicit short description|Template:GetShortDescription/no explicit short description]], also known as <span title="Japanese-language text"><span lang="ja">フレッドのテストページ</span></span>', { combined = 1 })
end
--[[ name, wedge and wedge_lang ga ]]
|desc_lang_italic= |desc_lang_nocat= |desc_lang_size= |desc_lang_cat= |desc_lang_rtl= |desc_lang_no=
function p:test__wedge__wedge_lang_ga()
]]
self:preprocess_equals("{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|wedge=Leathanach tástála Fred|wedge_lang=ga}}", '[[:Template:GetShortDescription/no explicit short description|Template:GetShortDescription/no explicit short description]], <span title="Irish-language text"><i lang="ga">Leathanach tástála Fred</i></span>', { combined = 1 })
end
--[[ name and mixed language ]]
function p:test__mixed_language()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|display=La page de test de Fred|link_lang=fr|aka=フレッドのテストページ|aka_lang=ja|wedge=Leathanach tástála Fred|wedge_lang=ga}}', '<span title="French-language text"><i lang="fr">[[:Template:GetShortDescription/no explicit short description|La page de test de Fred]]</i></span>, also known as <span title="Japanese-language text"><span lang="ja">フレッドのテストページ</span></span>, <span title="Irish-language text"><i lang="ga">Leathanach tástála Fred</i></span>', { combined = 1 })
end
function p:test__dash_value_comma()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|dash=,}}', "[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]], Explicit short description")
end
function p:test__desc_first_letter_case_upper()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|desc_first_letter_case=upper}}', "[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – Explicit short description")
end
--[[ categorisation of short descriptions with no spaces being displayed ]]
function p:test__categorise_no_space_descriptions()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description with no spaces}}', '[[:Template:GetShortDescription/explicit short description with no spaces|Template:GetShortDescription/explicit short description with no spaces]] – Spacelessness<span style="display:none" class="category-spaceless-annotation">Pages displaying short descriptions with no spaces</span>[[Category:Pages displaying short descriptions with no spaces via Module:Annotated link]]', {nowiki = 1})
end
function p:test__categorise_no_space_descriptions__space_cat()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description with no spaces|space_cat=meow}}', "[[:Template:GetShortDescription/explicit short description with no spaces|Template:GetShortDescription/explicit short description with no spaces]] – Spacelessness")
end
--[[ basic passthrough to Module:GetShortDescription ]]
--[[ only explicit ]]
function p:test__only_explicit__explicit_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|only=explicit}}', "[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – Explicit short description")
end
function p:test__only_explicit__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|only=explicit}}', "[[:Template:GetShortDescription/no explicit short description|Template:GetShortDescription/no explicit short description]]")
end
--[[ only wikidata ]]
function p:test__only_wikidata__wikidata_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|name=Wikipedia|only=wikidata}}', "[[:Wikipedia|Wikipedia]] – free multilingual online encyclopedia")
end
function p:test__only_wikidata__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|only=wikidata}}', "[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]]")
end
--[[ prefer explicit ]]
function p:test__only_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|name=Wikipedia|prefer=explicit}}', "[[:Wikipedia|Wikipedia]] – Free online crowdsourced encyclopedia")
end
function p:test__only_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|name=Example|prefer=explicit}}', '[[:Example|Example]] – Wikimedia disambiguation page<span style="display:none" class="category-wikidata-fallback-annotation">Pages displaying wikidata descriptions as a fallback</span>[[Category:Pages displaying wikidata descriptions as a fallback via Module:Annotated link]]', {nowiki = 1})
end
--[[ prefer wikidata ]]
function p:test__only_wikidata__wikidata_exists__explicit_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|name=Wikipedia|prefer=wikidata}}', "[[:Wikipedia|Wikipedia]] – free multilingual online encyclopedia")
end
function p:test__only_wikidata__wikidata_does_not_exist__explicit_exists()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|prefer=wikidata}}', "[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – Explicit short description")
end
-- [[ fallback ]]
function p:test__only_explicit__fallback__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/no explicit short description|only=explicit|fallback=this is a fallback}}', "[[:Template:GetShortDescription/no explicit short description|Template:GetShortDescription/no explicit short description]] – this is a fallback")
end
function p:test__only_wikidata__fallback__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:Annotated link|main|template_link=no|name=Template:GetShortDescription/explicit short description|only=wikidata|fallback=this is a fallback}}', "[[:Template:GetShortDescription/explicit short description|Template:GetShortDescription/explicit short description]] – this is a fallback")
end
-- [[ prefix_parentheses ]]
function p:test__prefix_parentheses()
self:preprocess_equals('{{#invoke:Annotated_link|main|name=Jimmy Wales|dash=,|prefix_parentheses=y|desc_first_letter_case=lower}}', "[[:Jimmy Wales|Jimmy Wales]] (born 1966), co-founder of Wikipedia")
self:preprocess_equals('{{#invoke:Annotated_link|main|name=Jimmy Wales|dash=,|desc_first_letter_case=lower}}', "[[:Jimmy Wales|Jimmy Wales]], co-founder of Wikipedia (born 1966)")
end
--[[ test the test; sanity check; should fail ]]
--function p:test_the_test()
-- self:preprocess_equals('{{#invoke:AnnotatedLinkAnnotated link|main|name=Example}}', "test the test")
--end
--[[ foreign language wikidata ]]
-- Testing |desc_lang_italic= |desc_lang_nocat= |desc_lang_size= |desc_lang_cat= |desc_lang_rtl= |desc_lang_no= will require a wikidata description in a language other than English to be returned
return p
|