!! Version 2
# Force the test runner to ensure the extension is loaded
!! functionhooks
af_ksort
!! endfunctionhooks
# This file tests the #af_ksort parser function
!! test
Test sort ascending
!! wikitext
{{#af_print: {{#af_ksort: {{#af_object: c=apple | a=banana | b=orange }} }} }}
!! html
- a: banana
- b: orange
- c: apple
!! end
!! test
Test sort descending
!! wikitext
{{#af_print: {{#af_ksort: {{#af_object: c=apple | a=banana | b=orange }} | descending=true }} }}
!! html
- c: apple
- b: orange
- a: banana
!! end
!! test
Test sort case insensitive
!! wikitext
{{#af_print: {{#af_ksort: {{#af_object: a=apple | A=banana | b=orange | B=lemon }} | caseinsensitive=true }} }}
!! html
- a: apple
- A: banana
- b: orange
- B: lemon
!! end
!! test
Test too many arguments
!! wikitext
{{#af_ksort: {{#af_object: c=apple | a=banana | b=orange }} | v }}
!! html
ArrayFunctions (#af_ksort): Expected at most 1 positional parameter, 2 given.
!! end