isa-ok
ErrorsCollection

isa-ok

Synthesised documentation from type/Test

From type/Test

See Original text in context

multi sub isa-ok(Mu $varMu $type$desc = "The object is-a '$type.raku()'")

Marks a test as passed if the given object $var is, or inherits from, the given $type. For convenience, types may also be specified as a string. The function accepts an optional description of the test, which defaults to a string that describes the object.

class Womble {}
class GreatUncleBulgaria is Womble {}
my $womble = GreatUncleBulgaria.new;
 
isa-ok $wombleWomble"Great Uncle Bulgaria is a womble";
isa-ok $womble'Womble';     # equivalent 

Note that, unlike isa, isa-ok also matches Roles:

say 42.isa(Numeric); # OUTPUT: «False␤» 
isa-ok 42Numeric;  # OUTPUT: «ok 1 - The object is-a 'Numeric'␤»