!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_bool !! endfunctionhooks # This file tests the #af_bool parser function !! test Test "no" is false !! wikitext {{#af_bool: no}} !! html
boolean__^__0
!! end !! test Test "false" is false !! wikitext {{#af_bool: false}} !! htmlboolean__^__0
!! end !! test Test "0" is false !! wikitext {{#af_bool: 0}} !! htmlboolean__^__0
!! end !! test Test "off" is false !! wikitext {{#af_bool: off}} !! htmlboolean__^__0
!! end !! test Test false is false !! wikitext {{#af_bool: {{#af_bool: no }} }} !! htmlboolean__^__0
!! end !! test Test "1" is true !! wikitext {{#af_bool: 1}} !! htmlboolean__^__1
!! end !! test Test "true" is true !! wikitext {{#af_bool: true}} !! htmlboolean__^__1
!! end !! test Test "on" is true !! wikitext {{#af_bool: on}} !! htmlboolean__^__1
!! end !! test Test "yes" is true !! wikitext {{#af_bool: yes}} !! htmlboolean__^__1
!! end !! test Test true is true !! wikitext {{#af_bool: {{#af_bool: yes }} }} !! htmlboolean__^__1
!! end !! test Test random gives error !! wikitext {{#af_bool: foobar}} !! htmlArrayFunctions (#af_bool): Could not match expected type boolean with actual type string for parameter 1 ("foobar").
!! end !! test Test empty gives error !! wikitext {{#af_bool: }} !! htmlArrayFunctions (#af_bool): Could not match expected type boolean with actual type empty for parameter 1 ("").
!! end !! test Test too many arguments !! wikitext {{#af_bool: yes | yes }} !! htmlArrayFunctions (#af_bool): Expected at most 1 positional parameter, 2 given.
!! end