!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_int !! endfunctionhooks # This file tests the #af_int parser function !! test Test positive integer !! wikitext {{#af_int: 10 }} !! html
integer__^__10
!! end !! test Test negative integer !! wikitext {{#af_int: -10 }} !! htmlinteger__^__-10
!! end !! test Test zero !! wikitext {{#af_int: 0 }} !! htmlinteger__^__0
!! end !! test Test integer is idempotent !! wikitext {{#af_int: 10 }} {{#af_int: {{#af_int: 10 }} }} !! htmlinteger__^__10 integer__^__10
!! end !! test Test large number interpreted as string !! wikitext {{#af_int: 1000000000000000000000000000000000000000000000000000000000000 }} !! htmlArrayFunctions (#af_int): Could not match expected type integer with actual type string for parameter 1 ("1000000000000000000000000000000000000000000000000000000000000").
!! end !! test Test large negative number interpreted as string !! wikitext {{#af_int: -1000000000000000000000000000000000000000000000000000000000000 }} !! htmlArrayFunctions (#af_int): Could not match expected type integer with actual type string for parameter 1 ("-1000000000000000000000000000000000000000000000000000000000000").
!! end !! test Test invalid type gives error !! wikitext {{#af_int: true }} !! htmlArrayFunctions (#af_int): Could not match expected type integer with actual type string for parameter 1 ("true").
!! end !! test Test too many arguments !! wikitext {{#af_int: 1 | yes }} !! htmlArrayFunctions (#af_int): Expected at most 1 positional parameter, 2 given.
!! end