!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_reduce !! endfunctionhooks # This file tests the #af_reduce parser function !! test Test no callable !! wikitext {{#af_reduce: {{#af_list: a | b | c }} | c | i }} !! html !! end !! test Test concatenation !! wikitext {{#af_reduce: {{#af_list: a | b | c }} | c | i | {{{c}}}{{{i}}} }} !! html
abc
!! end !! test Building an equation !! wikitext {{#af_reduce: {{#af_list: 2 | 3 | 5 | 7 | 11 }} | c | i | {{{c}}} + {{{i}}} | 0 }} !! html0 + 2 + 3 + 5 + 7 + 11
!! end !! test Inverse concatenation !! wikitext {{#af_reduce: {{#af_list: a | b | c | d | e }} | c | i | {{{i}}}{{{c}}} }} !! htmledcba
!! end !! test Test too many arguments !! wikitext {{#af_reduce: {{#af_list: a | b | c }} | c | i | 0 | 0 | foo }} !! htmlArrayFunctions (#af_reduce): Expected at most 5 positional parameters, 6 given.
!! end !! test Test too few arguments !! wikitext {{#af_reduce: {{#af_list: a | b | c }} | c }} !! htmlArrayFunctions (#af_reduce): Expected at least 3 positional parameters, 2 given.
!! end