=item *
+L</cmp_ok> throws an exception if the given operator isn't a valid Perl binary operator (except C<'='> and variants).
+It also tests in scalar context, so C<'..'> will be treated as the flip-flop operator and not the range operator.
+
+=item *
+
C<use_ok>, C<require_ok>, C<can_ok>, C<isa_ok>, C<new_ok>, C<subtest>, C<explain>, C<TODO> blocks and C<todo_skip> are not implemented.
=back
die @_, " at $file line $line.\n";
}
-sub sanitize_comment {
+sub _sanitize_comment {
$_[0] =~ s/\n+\z//;
$_[0] =~ s/#/\\#/g;
$_[0] =~ s/\n/\n# /g;
$plan = SKIP_ALL;
$plan_str = '1..0 # SKIP';
if (defined $value) {
- sanitize_comment($value);
+ _sanitize_comment($value);
$plan_str .= " $value" if length $value;
}
} else {
our @EXPORT = qw<
plan
- skip_all
skip
done_testing
pass
goto &Exporter::import;
}
-=head2 C<skip_all $reason>
-
-=cut
-
-sub skip_all {
- @_ = (skip_all => $_[0]);
- goto &plan;
-}
-
=head2 C<< skip $reason => $count >>
=cut
my $skip_str = "ok $test # skip";
if (defined $reason) {
- sanitize_comment($reason);
+ _sanitize_comment($reason);
$skip_str .= " $reason" if length $reason;
}
++$failed;
}
if (defined $desc) {
- sanitize_comment($desc);
+ _sanitize_comment($desc);
$test_str .= " - $desc" if length $desc;
}
my %binops = (
'or' => 'or',
- 'and' => 'and',
'xor' => 'xor',
+ 'and' => 'and',
'||' => 'hor',
+ ('//' => 'dor') x ($] >= 5.010),
'&&' => 'hand',
+ '|' => 'bor',
+ '^' => 'bxor',
+ '&' => 'band',
+
'lt' => 'lt',
'le' => 'le',
'gt' => 'gt',
'=~' => 'like',
'!~' => 'unlike',
- '~~' => 'smartmatch',
+ ('~~' => 'smartmatch') x ($] >= 5.010),
+
+ '+' => 'add',
+ '-' => 'substract',
+ '*' => 'multiply',
+ '/' => 'divide',
+ '%' => 'modulo',
+ '<<' => 'lshift',
+ '>>' => 'rshift',
+
+ '.' => 'concat',
+ '..' => 'flipflop',
+ '...' => 'altflipflop',
+ ',' => 'comma',
+ '=>' => 'fatcomma',
);
my %binop_handlers;
eval <<"IS_BINOP";
sub is_$name (\$\$;\$) {
my (\$got, \$expected, \$desc) = \@_;
- \@_ = ((\$got $op \$expected), \$desc);
+ \@_ = (scalar(\$got $op \$expected), \$desc);
goto &ok;
}
IS_BINOP
return if $no_diag;
my $msg = join '', map { defined($_) ? $_ : 'undef' } @_;
- sanitize_comment($msg);
+ _sanitize_comment($msg);
return unless length $msg;
local $\;
my $bail_out_str = 'Bail out!';
if (defined $desc) {
- sanitize_comment($desc);
+ _sanitize_comment($desc);
$bail_out_str .= " $desc" if length $desc; # Two spaces
}
diag_stream *STDERR;
+=head2 C<THREADSAFE>
+
+This constant evaluates to true if and only if L<Test::Leaner> is thread-safe, i.e. when this version of C<perl> is at least 5.8, has been compiled with C<useithreads> defined, and L<threads> has been loaded B<before> L<Test::Leaner>.
+In that case, it also needs a working L<threads::shared>.
+
=head1 DEPENDENCIES
L<perl> 5.6.