In module Test§

See primary documentation in context for sub can-ok.

multi can-ok(Mu $var, Str $meth, $desc = "..." )

Marks a test as passed if the given $var can run the method named $meth. The function accepts an optional description. For instance:

class Womble {
    method collect-rubbish { ... }
}
my $womble = Womble.new;

# with automatically generated test description
can-ok $womble, 'collect-rubbish';
#  => An object of type 'Womble' can do the method 'collect-rubbish'

# with human-generated test description
can-ok $womble, 'collect-rubbish', "Wombles can collect rubbish";
#  => Wombles can collect rubbish