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