!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_flatten !! endfunctionhooks # This file tests the #af_flatten parser function !! test Test flat array no depth 1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | b | c }} }} }} !! html !! end !! test Test flat array no depth 2 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | b | c }} | }} }} !! html !! end !! test Test flat array depth of 0 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | b | c }} | 0 }} }} !! html !! end !! test Test flat array depth of -1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | b | c }} | -1 }} }} !! html !! end !! test Test flat array depth of 1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | b | c }} | 1 }} }} !! html !! end !! test Test flat array depth of 999 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | b | c }} | 999 }} }} !! html !! end !! test Test two-dimensional array no depth 1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} }} }} !! html !! end !! test Test two-dimensional array no depth 2 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} | }} }} !! html !! end !! test Test two-dimensional array depth of 0 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} | 0 }} }} !! html !! end !! test Test two-dimensional array depth of -1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} | -1 }} }} !! html !! end !! test Test two-dimensional array depth of 1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} | 1 }} }} !! html !! end !! test Test two-dimensional array depth of 999 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} | 999 }} }} !! html !! end !! test Test mixed array !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | {{#af_list: b | c | d }} }} }} }} !! html !! end !! test Test empty array !! wikitext {{#af_print: {{#af_flatten: {{AF_EMPTY}} }} }} !! html !! end !! test Test one-dimensional array with booleans !! wikitext {{#af_print: {{#af_flatten: {{#af_list: boolean__^__1 | boolean__^__0 | boolean__^__1 }} }} }} !! html !! end !! test Test two-dimensional array with integers !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: integer__^__1 | integer__^__2 }} | {{#af_list: integer__^__3 | integer__^__4 }} }} }} }} !! html !! end !! test Test three-dimensional array !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: {{#af_list: a | b }} | c }} | d }} }} }} !! html !! end !! test Test three-dimensional array with depth of 1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: {{#af_list: a | b }} | c }} | d }} | 1 }} }} !! html !! end !! test Test three-dimensional array with depth of 2 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: {{#af_list: a | b }} | c }} | d }} | 2 }} }} !! html !! end !! test Test three-dimensional array with depth of 0 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: {{#af_list: a | b }} | c }} | d }} | 0 }} }} !! html !! end !! test Test deeply nested arrays with integers and booleans !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: {{#af_list: integer__^__1 | boolean__^__1 }} | boolean__^__0 }} | integer__^__2 }} }} }} !! html !! end !! test Test array with mixed nesting levels !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | {{#af_list: b | {{#af_list: c | d }} }} }} }} }} !! html !! end !! test Test array with booleans and depth of 1 !! wikitext {{#af_print: {{#af_flatten: {{#af_list: boolean__^__1 | {{#af_list: boolean__^__0 | boolean__^__1 }} }} | 1 }} }} !! html !! end !! test Test unevenly nested arrays !! wikitext {{#af_print: {{#af_flatten: {{#af_list: a | {{#af_list: b | {{#af_list: c | {{#af_list: d }} }} }} }} }} }} !! html !! end !! test Test array with depth greater than nesting level !! wikitext {{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b }} | c }} | 5 }} }} !! html !! end