!! Version 2
# Force the test runner to ensure the extension is loaded
!! functionhooks
af_intersect
!! endfunctionhooks
# This file tests the #af_intersect parser function
!! test
Test single array
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} }} }}
!! html
!! end
!! test
Test two disjunct arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} }}
!! html
!! end
!! test
Test two identical arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: a | b | c }} }} }}
!! html
!! end
!! test
Test overlapping arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: c | d | e }} }} }}
!! html
!! end
!! test
Test disjunct multiple arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: c | d | e }} | {{#af_list: e | f | g }} }} }}
!! html
!! end
!! test
Test overlapping multiple arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: a | d | e }} | {{#af_list: a | f | g }} }} }}
!! html
!! end
!! test
Test empty arrays
!! wikitext
{{#af_print: {{#af_intersect: {{AF_EMPTY}} | {{AF_EMPTY}} }} }}
!! html
!! end
!! test
Test single empty array
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{AF_EMPTY}} }} }}
!! html
!! end
!! test
Test mixed types
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | 1 | true | b }} | {{#af_list: b | 1 | false | c }} }} }}
!! html
!! end
!! test
Test nested arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: {{#af_list: a | b }} | c }} | {{#af_list: {{#af_list: a | b }} | d }} }} }}
!! html
!! end
!! test
Test objects as arrays
!! wikitext
{{#af_print: {{#af_intersect: {{#af_object: key1=a | key2=b }} | {{#af_object: key2=b | key3=c }} }} }}
!! html
!! end
!! test
Test duplicate values in single array
!! wikitext
{{#af_print: {{#af_intersect: {{#af_list: a | b | b | c }} | {{#af_list: b | c }} }} }}
!! html
!! end