sub is
Documentation for sub is
assembled from the following types:
module Test
From Test
(Test) sub is
Defined as
multi sub is(Mu , Mu , = '')multi sub is(Mu , Mu , = '')
Marks a test as passed if $value
and $expected
compare positively with the eq operator, unless $expected
is a type object, in which case ===
operator will be used instead; accepts an optional description of the test as the last argument.
NOTE: eq
operator the is()
uses stringifies, which means is()
is not a good function for testing more complex things, such as lists: is (1, (2, (3,))), [1, 2, 3]
passes the test, even though the operands are vastly different. For those cases, use is-deeply
routine
my ; sub factorial() ; ...;is .author, "Joe", 'Retrieving the author field';is factorial(6), 720, 'Factorial - small integer';my Int ;is , Int, 'The variable $a is an unassigned Int';
Note: if only whitespace differs between the values, is()
will output failure message differently, to show the whitespace in each values. For example, in the output below, the second test shows the literal \t
in the got:
line:
is "foo\tbar", "foo\tbaz"; # expected: 'foo baz'# got: 'foo bar'is "foo\tbar", "foo bar"; # expected: "foo bar"# got: "foo\tbar"