Permalink
Browse files

[t/spec] removed some obsolete usages of 'is $stuff, undef'

git-svn-id: http://svn.pugscode.org/pugs@22256 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent afb51c3 commit de076fdd8c67e6398fc2c4a43fcad525a9db528d moritz committed Sep 15, 2008
@@ -49,7 +49,7 @@ plan 34;
is(%hash<k1>[0], 11, 'first element in k1 is 11');
#?rakudo skip "whatever star"
is(%hash<k1>[*-1], 15, 'last element in k1 is 15');
- is(%hash<12>, undef, 'nothing at key "12"');
+ ok(%hash<12> ~~ undef, 'nothing at key "12"');
}
{
@@ -63,8 +63,8 @@ plan 34;
is(%hash<k2>[0], 21, 'first element in k1 is 21');
#?rakudo skip "whatever star"
is(%hash<k2>[*-1], 25, 'last element in k1 is 25');
- is(%hash<12>, undef, 'nothing at key "12"');
- is(%hash<22>, undef, 'nothing at key "22"');
+ ok(%hash<12> ~~ undef, 'nothing at key "12"');
+ ok(%hash<22> ~~ undef, 'nothing at key "22"');
}
{
@@ -79,7 +79,7 @@ $a = undef;
is($a++, 0, 'undef++ == 0');
$a = undef;
-is($a--, undef, 'undef-- is undefined');
+ok($a-- ~~ undef, 'undef-- is undefined');
$a = 'x';
is($a++, 'x', 'magical ++ should not be numified');
@@ -25,7 +25,7 @@ plan 21;
my $var;
my $sub = sub ($x) { START { $var += $x } };
- is $var, undef, 'START {...} has not run yet';
+ ok $var ~~ undef 'START {...} has not run yet';
$sub(2);
is $var, 2, 'START {} has executed';
@@ -97,7 +97,7 @@ for <first second> {
my $was_in_start;
my $sub = { START { $was_in_start++; undef } };
- is $sub(), undef, 'START {} returned undef';
+ ok $sub() ~~ undef, 'START {} returned undef';
$sub();
$sub();
is $was_in_start, 1,
@@ -54,7 +54,8 @@ is( @l, [], "A bare return is an empty list in array/list context");
my $s = "hello";
$s = bare_return();
-is($s, undef, "A bare return is undef in scalar context");
+#?rakudo todo 'bare return is undef'
+ok($s ~~ undef, "A bare return is undef in scalar context");
## scalars
@@ -104,7 +104,7 @@ is(assign_based_on_named_positional($var => 2), ("y"=>2),
is(eval('named_array2(:!y, 1)'), (1, 42, 0), 'named and unnamed args - one named, one pos');
is(eval('named_array2(1, :!y)'), (1, 42, 0), 'named and unnamed args - one named, one pos - backwards');
is(eval('named_array2(:y, 1, :!y)'), (1, 42, 1, 0), 'named and unnamed args - two named, one pos');
- is(eval('named_array2(:y, :y)'), undef, 'named and unnamed args - two named with same name');
+ ok(eval('named_array2(:y, :y)') ~~ undef, 'named and unnamed args - two named with same name');
is(eval('named_array2(:y, (:x))'), (0, 1, 42, 1), 'named and unnamed args - passing parenthesized pair');
is(eval('named_array2(:y, (:y))'), (0, 1, 42, 1), 'named and unnamed args - passing parenthesized pair of same name');
is(eval('named_array2(:y, :z)'), (0, 1, 42, 1), 'named and unnamed args - passing pair of unrelated name');
@@ -140,7 +140,7 @@ sub formalize($text, :$case, :$justify) returns List {
{
my ($text,$case,$justify) = formalize('title', case=>'upper');
is($text,'title', "text param was positional");
-is($justify, undef, "justification param was not given");
+ok($justify ~~ undef, "justification param was not given");
is($case, 'upper', "case param was named, and in justification param's position");
}
@@ -149,7 +149,7 @@ is($case, 'upper', "case param was named, and in justification param's position"
my ($text,$case,$justify) = formalize('title', justify=>'left');
is($text,'title', "text param was positional");
is($justify, 'left', "justify param was named");
-is($case, undef, "case was not given at all");
+ok($case ~~ undef, "case was not given at all");
}
#?rakudo skip 'parsefail'
@@ -174,7 +174,7 @@ my %fellowship = slurpee(hobbit => 'Frodo', wizard => 'Gandalf');
is(%fellowship<hobbit>, 'Frodo', "hobbit arg was slurped");
is(%fellowship<wizard>, 'Gandalf', "wizard arg was slurped");
is(+%fellowship, 2, "exactly 2 arguments were slurped");
-is(%fellowship<dwarf>, undef, "dwarf arg was not given");
+ok(%fellowship<dwarf> ~~ undef, "dwarf arg was not given");
}
#?rakudo skip 'parsefail on lvalue'
@@ -185,7 +185,7 @@ is(%fellowship<dwarf>, undef, "dwarf arg was not given");
is(+%rest, 2, "exactly 2 arguments were slurped");
is(%rest<sky>, 'blue', "sky argument was slurped");
is(%rest<fire>, 'red', "fire argument was slurped");
- is(%rest<grass>, undef, "grass argument was NOT slurped");
+ ok(%rest<grass> ~~ undef, "grass argument was NOT slurped");
}
#?rakudo skip 'positional value passed by name did not work'

0 comments on commit de076fd

Please sign in to comment.