Attribute-Property
view release on metacpan or search on metacpan
t/lib/Test/Builder.pm view on Meta::CPAN
=cut
sub maybe_regex {
my ($self, $regex) = @_;
my $usable_regex = undef;
if( ref $regex eq 'Regexp' ) {
$usable_regex = $regex;
}
# Check if it looks like '/foo/'
elsif( my($re, $opts) = $regex =~ m{^ /(.*)/ (\w*) $ }sx ) {
$usable_regex = length $opts ? "(?$opts)$re" : $re;
};
return($usable_regex)
};
sub _regex_ok {
my($self, $this, $regex, $cmp, $name) = @_;
local $Level = $Level + 1;
t/lib/Test/Builder.pm view on Meta::CPAN
name => name of the test (if any)
type => 'skip' or 'todo' (if any)
reason => reason for the above (if any)
};
=item B<todo>
my $todo_reason = $Test->todo;
my $todo_reason = $Test->todo($pack);
todo() looks for a $TODO variable in your tests. If set, all tests
will be considered 'todo' (see Test::More and Test::Harness for
details). Returns the reason (ie. the value of $TODO) if running as
todo tests, false otherwise.
todo() is pretty part about finding the right package to look for
$TODO in. It uses the exported_to() package to find it. If that's
not set, it's pretty good at guessing the right package to look at.
Sometimes there is some confusion about where todo() should be looking
for the $TODO variable. If you want to be sure, tell it explicitly
t/lib/Test/More.pm view on Meta::CPAN
like($this, qr/that/, 'this is like that');
is similar to:
ok( $this =~ /that/, 'this is like that');
(Mnemonic "This is like that".)
The second argument is a regular expression. It may be given as a
regex reference (i.e. C<qr//>) or (for better compatibility with older
perls) as a string that looks like a regex (alternative delimiters are
currently not supported):
like( $this, '/that/', 'this is like that' );
Regex options may be placed on the end (C<'/that/i'>).
Its advantages over ok() are similar to that of is() and isnt(). Better
diagnostics on failure.
=cut
( run in 0.564 second using v1.01-cache-2.11-cpan-607d282f910 )