Skip to content

Commit

Permalink
[t/spec]: Update some Nil-related tests for undefined Nil.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@32057 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
pmichaud committed Aug 19, 2010
1 parent 6df68e5 commit feebd08
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions S02-builtin_data_types/nil.t
Expand Up @@ -31,9 +31,8 @@ ok (my $y = ()).defined, 'assigning () to scalar results in a defined parcel';

$calls = 0;
ok return_nil() ~~ Nil, 'return_nil() ~~ Nil';
is return_nil().WHAT, 'Parcel()', 'return_nil().WHAT says Parcel';
is return_nil.WHAT, 'Parcel()', 'return_nil.WHAT says Nil';
is $calls, 3, 'return_nil() called thrice';
is return_nil().WHAT, 'Nil()', 'return_nil().WHAT says Nil';
is $calls, 2, 'return_nil() called twice';

my $n = return_nil();
ok $n.notdef, 'variable holding nil is not defined';
Expand Down
6 changes: 3 additions & 3 deletions S02-builtin_data_types/undefined-types.t
Expand Up @@ -6,7 +6,7 @@ plan *;

{
# Nil is an empty container. As a container, it is defined.
ok Nil.defined, 'Nil is defined';
ok !Nil.defined, 'Nil is undefined';
ok ().defined, '() is defined';
my @a;
@a.push: Nil;
Expand All @@ -24,9 +24,9 @@ plan *;
@a.push: 2, sink { $i = 2 };
is @a.elems, 1, 'sink block prefix returns Nil (list context)';
is $i, 2, 'the block was executed';
ok defined(sink $i = 5 ), 'sink in scalar context (statement)';
ok !defined(sink $i = 5 ), 'sink in scalar context (statement)';
is $i, 5, '... statement executed';
ok defined(sink {$i = 8} ), 'sink in scalar context (block)';
ok !defined(sink {$i = 8} ), 'sink in scalar context (block)';
is $i, 8, '... block executed';
}

Expand Down
2 changes: 1 addition & 1 deletion S04-statements/for.t
Expand Up @@ -466,7 +466,7 @@ eval_dies_ok('for(0..5) { }','keyword needs at least one whitespace after it');
{
sub rt71268 { for ^1 {} }
lives_ok { ~(rt71268) }, 'can stringify "for ^1 {}" without death';
ok rt71268() ~~ Nil, 'result of "for ^1 {}" is Nil (what else?)';
ok rt71268() ~~ (), 'result of "for ^1 {}" is ()';
}

# RT 62478
Expand Down
10 changes: 5 additions & 5 deletions integration/99problems-31-to-40.t
Expand Up @@ -159,11 +159,11 @@ plan 67;
take [$cond,$count];
}
}
is prime_factors_mult(1),[], "We ignore 1";
is prime_factors_mult(2),[[2,1]], "We get prime numbers prime";
is prime_factors_mult(4),[[2,2]], ".. and multiplicity right";
is prime_factors_mult(12),[[2,2],[3,1]], ".. and products of primes";
is prime_factors_mult(315),[[3,2],[5,1],[7,1]], ".. and ignore multiplicity 0"
is prime_factors_mult(1),(), "We ignore 1";
is prime_factors_mult(2),([2,1]), "We get prime numbers prime";
is prime_factors_mult(4),([2,2]), ".. and multiplicity right";
is prime_factors_mult(12),([2,2],[3,1]), ".. and products of primes";
is prime_factors_mult(315),([3,2],[5,1],[7,1]), ".. and ignore multiplicity 0"
}

{
Expand Down

0 comments on commit feebd08

Please sign in to comment.