!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_template !! endfunctionhooks # This file tests the #af_template parser function !! article Template:Hello !! text Hello, {{{user}}}! Welcome to {{{wiki}}}. !! endarticle !! article Template:HelloProxy !! text {{#af_template: Hello | {{{data}}} }} !! endarticle !! article Hello !! text {{#af_template: Hello | {{{data}}} }} !! endarticle !! test Test one-dimensional object !! wikitext {{#af_template: Hello | {{#af_object: user=Marijn | wiki=Wikipedia }} }} !! html
Hello, Marijn! Welcome to Wikipedia.
!! end !! test Test multi-dimensional !! wikitext {{#af_template: HelloProxy | {{#af_object: data={{#af_object: user=Marijn | wiki=Wikipedia }} }} }} !! htmlHello, Marijn! Welcome to Wikipedia.
!! end !! test Test main namespace !! wikitext {{#af_template: :Hello | {{#af_object: data={{#af_object: user=Marijn | wiki=Wikipedia }} }} }} !! htmlHello, Marijn! Welcome to Wikipedia.
!! end !! test Test too few arguments !! wikitext {{#af_template: HelloProxy }} !! htmlArrayFunctions (#af_template): Expected at least 2 positional parameters, 1 given.
!! end !! test Test too many arguments !! wikitext {{#af_template: HelloProxy | {{#af_object: a=a }} | b }} !! htmlArrayFunctions (#af_template): Expected at most 2 positional parameters, 3 given.
!! end