!! Version 2
# Force the test runner to ensure the extension is loaded
!! functionhooks
af_split
!! endfunctionhooks
# This file tests the #af_split parser function
!! test
Test comma is default delimiter 1
!! wikitext
{{#af_print: {{#af_split: a,b }} }}
!! html
!! end
!! test
Test comma is default delimiter 2
!! wikitext
{{#af_print: {{#af_split: a,b |}} }}
!! html
!! end
!! test
Test alternative delimiter
!! wikitext
{{#af_print: {{#af_split: a;b |;}} }}
!! html
!! end
!! test
Test space delimiter
!! wikitext
{{#af_print: {{#af_split: a b |\s}} }}
!! html
!! end
!! test
Test newline delimiter
!! wikitext
{{#af_print: {{#af_split: a
b |\n}} }}
!! html
!! end
!! test
Test empty string
!! wikitext
{{#af_print: {{#af_count: {{#af_split: |,}} }} }}
!! html
0
!! end
!! test
Test too many arguments
!! wikitext
{{#af_split: a,b,c | , | v }}
!! html
ArrayFunctions (#af_split): Expected at most 2 positional parameters, 3 given.
!! end