!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_exists !! endfunctionhooks # This file tests the #af_exists parser function !! test Test string key exists !! wikitext {{#af_exists: {{#af_object: foobar=foobar | boofar=boofar }} | foobar }} !! html

boolean__^__1

!! end !! test Test integer key exists !! wikitext {{#af_exists: {{#af_list: foobar | boofar }} | 1 }} !! html

boolean__^__1

!! end !! test Test string key does not exist !! wikitext {{#af_exists: {{#af_object: foobar=foobar | boofar=boofar }} | notakey }} !! html

boolean__^__0

!! end !! test Test integer key does not exist !! wikitext {{#af_exists: {{#af_list: foobar | boofar }} | 5 }} !! html

boolean__^__0

!! end !! test Test key exists in nested object !! wikitext {{#af_exists: {{#af_object: key1={{#af_object: key2=value2 }} }} | key1 | key2 }} !! html

boolean__^__1

!! end !! test Test key does not exists in nested object 1 !! wikitext {{#af_exists: {{#af_object: key2={{#af_object: key1=value2 }} }} | key1 | key2 }} !! html

boolean__^__0

!! end !! test Test key does not exist in nested object 2 !! wikitext {{#af_exists: {{#af_object: key1={{#af_object: key2=value2 }} }} | key1 | key3 }} !! html

boolean__^__0

!! end !! test Test empty object !! wikitext {{#af_exists: {{AF_EMPTY}} | foobar }} !! html

boolean__^__0

!! end !! test Test empty list !! wikitext {{#af_exists: {{AF_EMPTY}} | 0 }} !! html

boolean__^__0

!! end