sub is

Documentation for sub is assembled from the following types:

class Test

From Test

(Test) sub is

Defined as

multi sub is(Mu $gotMu:U $expected$desc = '')
multi sub is(Mu $gotMu:D $expected$desc = '')

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 $pdf-documentsub factorial($x{ ... }...;
    is $"Joe"'Retrieving the author field';
    is factorial(6),         720,   'Factorial - small integer';
    my Int $a;
    is $aInt'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"