eval <<"IS_BINOP";
sub is_$name (\$\$;\$) {
my (\$x, \$y, \$desc) = \@_;
- no warnings 'uninitialized';
- \@_ = (
- (not(defined \$x xor defined \$y) and \$x $op \$y),
- \$desc,
- );
+ \@_ = ((\$x $op \$y), \$desc);
goto &ok;
}
IS_BINOP
}
}
-{
- no warnings 'once';
- *is = \&is_eq;
- *like = \&is_like;
- *unlike = \&is_unlike;
+sub is ($$;$) {
+ my ($got, $expected, $desc) = @_;
+ no warnings 'uninitialized';
+ @_ = (
+ (not(defined $got xor defined $expected) and $got eq $expected),
+ $desc,
+ );
+ goto &ok;
}
sub isnt ($$;$) {
goto &ok;
}
+{
+ no warnings 'once';
+ *like = \&is_like;
+ *unlike = \&is_unlike;
+}
+
sub cmp_ok ($$$;$) {
my ($x, $op, $y, $desc) = @_;
my $name = $binops{$op};
use Test::Leaner;
-plan tests => 7;
+plan tests => 8;
is undef, undef, 'undef is undef';
-isnt 1, undef, 'one is not undef';
-isnt undef, 1, 'undef is not one';
+isnt 0, undef, 'zero is not undef';
+isnt undef, 0, 'undef is not zero';
+is 0, 0, 'zero is zero';
is 1, 1, 'one is one';
isnt '1.0', 1, '1.0 is not one string-wise';