!! Version 2
# Force the test runner to ensure the extension is loaded
!! functionhooks
af_set
!! endfunctionhooks
# This file tests the #af_set parser function
!! test
Test overwrite key
!! wikitext
{{#af_print: {{#af_set: b | {{#af_object: a=a }} | a }} }}
!! html
!! end
!! test
Test add new key
!! wikitext
{{#af_print: {{#af_set: b | {{#af_object: a=a }} | b }} }}
!! html
!! end
!! test
Test set on list
!! wikitext
{{#af_print: {{#af_set: b | {{#af_list: a }} | b }} }}
!! html
!! end
!! test
Test numeric key on object
!! wikitext
{{#af_print: {{#af_set: b | {{#af_object: a=a }} | 0 }} }}
!! html
!! end
!! test
Test non-existent numeric key on list
!! wikitext
{{#af_print: {{#af_set: b | {{#af_list: a }} | 1 }} }}
!! html
!! end
!! test
Test numeric key on list
!! wikitext
{{#af_print: {{#af_set: b | {{#af_list: a }} | 0 }} }}
!! html
!! end
!! test
Test nested set
!! wikitext
{{#af_print: {{#af_set: d | {{#af_object: a={{#af_object: b={{#af_object: c=c | d=d }} }} }} | a | b | c }} }}
!! html
!! end
!! test
Test too few arguments
!! wikitext
{{#af_set: a | {{#af_list: b }} }}
!! html
ArrayFunctions (#af_set): Expected at least 3 positional parameters, 2 given.
!! end