Skip to content

Commit

Permalink
Remove most remaining .notdef's.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhore committed Feb 23, 2011
1 parent 08f1960 commit 2544bcf
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions S02-builtin_data_types/array_extending.t
Expand Up @@ -81,8 +81,8 @@ plan 21;
my @a;
@a[2] = 6;
is +@a, 3, '@a[2] = 6 ensures that @a has three items';
ok @a[0].notdef, '... and the first is not defined';
ok @a[1].notdef, '... and the second is not defined';
nok @a[0].defined, '... and the first is not defined';
nok @a[1].defined, '... and the second is not defined';
is @a[2], 6, '... and the third is 6';
}

Expand Down
6 changes: 3 additions & 3 deletions S02-builtin_data_types/flattening.t
Expand Up @@ -43,7 +43,7 @@ plan 33;
is(%hash<k1>.elems, 5, 'k1 has 5 elements');
is(%hash<k1>[0], 11, 'first element in k1 is 11');
is(%hash<k1>[*-1], 15, 'last element in k1 is 15');
ok(%hash<12>.notdef, 'nothing at key "12"');
nok(%hash<12>.defined, 'nothing at key "12"');
}

{
Expand All @@ -55,8 +55,8 @@ plan 33;
is(%hash<k1>[*-1], 15, 'last element in k1 is 15');
is(%hash<k2>[0], 21, 'first element in k1 is 21');
is(%hash<k2>[*-1], 25, 'last element in k1 is 25');
ok(%hash<12>.notdef, 'nothing at key "12"');
ok(%hash<22>.notdef, 'nothing at key "22"');
nok(%hash<12>.defined, 'nothing at key "12"');
nok(%hash<22>.defined, 'nothing at key "22"');
}

{
Expand Down
4 changes: 2 additions & 2 deletions S02-builtin_data_types/lazy-lists.t
Expand Up @@ -86,13 +86,13 @@ is( (1..Inf)[2..5],
my @a = (1..Inf);
@a[1].delete;
is ~@a[0, 2], '1 3', 'array elemente delete (1)';
ok @a[1].notdef, 'array element delete (2)';
nok @a[1].defined, 'array element delete (2)';
}

{
my @a = (1..Inf);
@a[0,1].delete;
ok( all(@a[0, 1]).notdef,
nok( all(@a[0, 1]).defined,
"array slice delete()" );
}

Expand Down
2 changes: 1 addition & 1 deletion S02-builtin_data_types/nil.t
Expand Up @@ -35,7 +35,7 @@ ok (my $y = ()).defined, 'assigning () to scalar results in a defined parcel';
is $calls, 2, 'return_nil() called twice';

my $n = return_nil();
ok $n.notdef, 'variable holding nil is not defined';
nok $n.defined, 'variable holding nil is not defined';
}

{
Expand Down
2 changes: 1 addition & 1 deletion S02-names_and_variables/contextual.t
Expand Up @@ -39,7 +39,7 @@ my $o = CT.new;
is CT.foo_priv, 'one', 'back (private class method)';
}

ok foo().notdef, 'contextual $*VAR is undefined';
nok foo().defined, 'contextual $*VAR is undefined';

{
sub a1() { @*AR; @*AR.join('|') };
Expand Down
6 changes: 3 additions & 3 deletions S02-names_and_variables/variables-and-packages.t
Expand Up @@ -94,7 +94,7 @@ ok !eval('module COMPILING; 1'), 'COMPILING is an out of scope name';
}

{
ok foo().notdef, "get variable not yet declared using a sub (1)";
nok foo().defined, "get variable not yet declared using a sub (1)";
is foo(), 1, "get variable not yet declared using a sub (2)";
is foo(), 2, "get variable not yet declared using a sub (3)";

Expand All @@ -103,7 +103,7 @@ ok !eval('module COMPILING; 1'), 'COMPILING is an out of scope name';
}

{
ok bar().notdef, "runtime part of my not yet executed (1)";
nok bar().defined, "runtime part of my not yet executed (1)";
is bar(), 1, "runtime part of my not yet executed (2)";
is bar(), 2, "runtime part of my not yet executed (3)";

Expand Down Expand Up @@ -136,7 +136,7 @@ ok !eval('module COMPILING; 1'), 'COMPILING is an out of scope name';
my $a;
sub rmbl { $a++ }

ok rmbl().notdef, "var captured by sub is the right var (1)";
nok rmbl().defined, "var captured by sub is the right var (1)";
$a++;
is rmbl(), 2, "var captured by sub is the right var (2)";
}
Expand Down
2 changes: 1 addition & 1 deletion S04-declarations/my.t
Expand Up @@ -224,7 +224,7 @@ my $z = 42;
}

{
ok declare_later().notdef,
nok declare_later().defined,
'Can access variable returned from a named closure that is declared below the calling position';
my $x;
sub declare_later {
Expand Down
8 changes: 4 additions & 4 deletions S04-phasers/ascending-order.t
Expand Up @@ -51,10 +51,10 @@ END {
}

is $hist, 'begin check init start ', 'BEGIN {} runs only once';
ok $var_at_begin.notdef, 'BEGIN {...} ran at compile time';
ok $var_at_check.notdef, 'CHECK {...} ran at compile time';
ok $var_at_init.notdef, 'INIT {...} ran at runtime, but ASAP';
ok $var_at_enter.notdef, 'ENTER {...} at runtime, but before the mainline body';
nok $var_at_begin.defined, 'BEGIN {...} ran at compile time';
nok $var_at_check.defined, 'CHECK {...} ran at compile time';
nok $var_at_init.defined, 'INIT {...} ran at runtime, but ASAP';
nok $var_at_enter.defined, 'ENTER {...} at runtime, but before the mainline body';
is $var_at_start, 14, 'START {...} at runtime, just in time';

$eof_var = 29;
Expand Down
8 changes: 4 additions & 4 deletions S04-phasers/descending-order.t
Expand Up @@ -45,10 +45,10 @@ BEGIN {
}

is $hist, 'begin check init ', 'BEGIN {} runs only once';
ok $var_at_begin.notdef, 'BEGIN {...} ran at compile time';
ok $var_at_check.notdef, 'CHECK {...} ran at compile time';
ok $var_at_init.notdef, 'INIT {...} ran at runtime, but ASAP';
ok $var_at_enter.notdef, 'ENTER {...} at runtime, but before the mainline body';
nok $var_at_begin.defined, 'BEGIN {...} ran at compile time';
nok $var_at_check.defined, 'CHECK {...} ran at compile time';
nok $var_at_init.defined, 'INIT {...} ran at runtime, but ASAP';
nok $var_at_enter.defined, 'ENTER {...} at runtime, but before the mainline body';

$eof_var = 29;

Expand Down
4 changes: 2 additions & 2 deletions S04-phasers/exit-in-begin.t
Expand Up @@ -9,14 +9,14 @@ $failed = 1;

# When we end, we check if $failed is still 0. If yes, we've never reached runtime.
END {
ok $failed.notdef,
nok $failed.defined,
'exit() works in BEGIN {} - $fail not yet initialized at END time';
}

BEGIN {
# Output the TAP header...
plan 2;
ok $failed.notdef, '$failed not yet initialized in BEGIN {}';
nok $failed.defined, '$failed not yet initialized in BEGIN {}';
# ...and exit, implicitly calling END.
exit;
}
Expand Down
6 changes: 3 additions & 3 deletions S04-phasers/exit-in-check.t
Expand Up @@ -9,14 +9,14 @@ $failed = 1;

# When we end, we check if $failed is still 0. If yes, we've never reached runtime.
END {
ok $failed.notdef,
nok $failed.defined,
'exit() works in CHECK {} - $fail not yet initialized at END time';
}

CHECK {
# Output the TAP header...
plan 2;
ok $failed.notdef, '$failed not yet initialized in CHECK {}';
nok $failed.defined, '$failed not yet initialized in CHECK {}';
# ...and exit, implicitly calling END.
exit;
}
Expand Down Expand Up @@ -46,7 +46,7 @@ END {
CHECK {
# Output the TAP header...
plan 1;
ok $failed.notdef, 'exit() works in CHECK {}';
nok $failed.defined, 'exit() works in CHECK {}';
# ...and exit, which does _not_ call END.
exit;
}
Expand Down
2 changes: 1 addition & 1 deletion S04-phasers/first.t
Expand Up @@ -19,7 +19,7 @@ plan 4;
$a++;
FIRST { $a_in_first = $a }
}
ok $a_in_first.notdef, 'FIRST {} ran before the loop body';
nok $a_in_first.defined, 'FIRST {} ran before the loop body';
}

# L<S04/Phasers/can occur multiple times>
Expand Down
6 changes: 3 additions & 3 deletions S04-phasers/in-eval.t
Expand Up @@ -18,7 +18,7 @@ our $h;
eval '$handle = { $h ~= "1"; START { $h ~= "F" }; $h ~= "2" }';
ok $! !~~ Exception, 'eval START {...} works';

ok $h.notdef, 'START {...} has not run yet';
nok $h.defined, 'START {...} has not run yet';
lives_ok { $handle() }, 'can run code with START block';
is $h, '1F2', 'START {...} fired';
lives_ok { $handle() }, 'can run code with START block again';
Expand All @@ -41,7 +41,7 @@ our $h;

eval '$handle = { $h =~ "r"; INIT { $h ~= "I" }; $h ~= "R" }';
ok $! !~~ Exception, 'eval INIT {...} works';
ok $h.notdef, 'INIT did not run at compile time';
nok $h.defined, 'INIT did not run at compile time';
#?rakudo 4 todo 'Could not find non-existent sub INIT'
lives_ok { $handle() }, 'can run code with INIT block';
is $h, 'IrR', 'INIT {...} fires at run-time';
Expand Down Expand Up @@ -90,7 +90,7 @@ our $h;
eval '$handle = { our $end ~= "1"; END { our $end ~= "E" }; our $end ~= "2" }';
ok $! !~~ Exception, 'eval END {...} works';

ok $end.notdef, 'END {} has not run yet';
nok $end.defined, 'END {} has not run yet';
lives_ok { $handle() }, 'can call code with END block';
is $end, '12', 'END {} does not run at run time either';
}
Expand Down
2 changes: 1 addition & 1 deletion S04-phasers/interpolate.t
Expand Up @@ -24,7 +24,7 @@ END {
is $hist, 'BCISE', 'interpolated END {...} executed';
}

ok "{ END { $hist ~= 'E' } }".notdef,
nok "{ END { $hist ~= 'E' } }".defined,
'END {...} not yet executed';

is "{ START { $hist ~= 'S' } }", "BCIS",
Expand Down
4 changes: 2 additions & 2 deletions S05-grammar/ws.t
Expand Up @@ -16,9 +16,9 @@ grammar T1 {
ok 'x' ~~ m/^<T1::ws>$/, 'basic sanity with custom <ws> rules';
is $/, 'x', 'correct text captured';
ok 'axb' ~~ m/^<T1::r1>$/, 'implicit <.ws> is overridden';
ok $<T1::r1><ws>.notdef, 'implicit <.ws> did not capture';
nok $<T1::r1><ws>.defined, 'implicit <.ws> did not capture';
ok 'axb' ~~ m/^<T1::r2>$/, 'explicit <.ws> is overridden';
ok $<T1::r2><ws>.notdef, 'explicit <.ws> did not capture';
nok $<T1::r2><ws>.defined, 'explicit <.ws> did not capture';
ok 'axb' ~~ m/^<T1::r3>$/, 'explicit <ws> is overridden';
is $<T1::r3><ws>, 'x', 'explicit <ws> did capture';

Expand Down
2 changes: 1 addition & 1 deletion S05-match/positions.t
Expand Up @@ -24,7 +24,7 @@ ok($/.from == 3, 'Match.from is 3');

ok($str !~~ m/ Z .+ a /, 'No match');
#?rakudo skip 'unspecced'
ok($/.from.notdef, 'Match pos is undefined');
nok($/.from.defined, 'Match pos is undefined');

my regex Aa { A .* a }
#?rakudo 3 skip 'lexical lookup of <Aa>'
Expand Down
2 changes: 1 addition & 1 deletion S05-metasyntax/angle-brackets.t
Expand Up @@ -77,7 +77,7 @@ character classes), and those are referenced at the correct spot.
{
ok '123gb' ~~ / <foo=.alpha> /, '<foo=.bar>';
is $<foo>, 'g', '=. renaming worked';
ok $<alpha>.notdef, '=. removed the old capture name';
nok $<alpha>.defined, '=. removed the old capture name';
}

# If the first character after the identifier is whitespace, the subsequent
Expand Down
2 changes: 1 addition & 1 deletion S05-modifier/perl5_0.t
Expand Up @@ -79,7 +79,7 @@ so it looks like a pugs-pcre interface bug.

{
"a" ~~ m:Perl5/a|(b)/;
ok($0.notdef, 'An unmatched capture should be undefined.');
nok($0.defined, 'An unmatched capture should be undefined.');
my $str = "http://foo.bar/";
ok(($str ~~ m:Perl5 {http{0,1}}));

Expand Down
10 changes: 5 additions & 5 deletions S06-signature/named-parameters.t
Expand Up @@ -124,7 +124,7 @@ is(assign_based_on_named_positional($var => 2), ("y"=>2),
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');

ok(eval('named_array2(:y, :y)').notdef, 'named and unnamed args - two named with same name');
nok(eval('named_array2(:y, :y)').defined, 'named and unnamed args - two named with same name');

#?rakudo 4 todo "named arguments not fully up to spec"
is(eval('named_array2(:y, (:x))'), (0, 1, 42, 1), 'named and unnamed args - passing parenthesized pair');
Expand Down Expand Up @@ -161,15 +161,15 @@ sub formalize($text, :$case, :$justify) {
{
my ($text,$case,$justify) = formalize('title', case=>'upper');
is($text,'title', "text param was positional");
ok($justify.notdef, "justification param was not given");
nok($justify.defined, "justification param was not given");
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");
ok($case.notdef, "case was not given at all");
nok($case.defined, "case was not given at all");
}

{
Expand All @@ -193,7 +193,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");
ok(%fellowship<dwarf>.notdef, "dwarf arg was not given");
nok(%fellowship<dwarf>.defined, "dwarf arg was not given");
}

{
Expand All @@ -203,7 +203,7 @@ ok(%fellowship<dwarf>.notdef, "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");
ok(%rest<grass>.notdef, "grass argument was NOT slurped");
nok(%rest<grass>.defined, "grass argument was NOT slurped");
}

{
Expand Down
2 changes: 1 addition & 1 deletion S06-signature/slurpy-params.t
Expand Up @@ -139,7 +139,7 @@ Blechschmidt L<http://www.nntp.perl.org/group/perl.perl6.language/22883>
diag("Testing with named arguments (named param isn't required)");
lives_ok { foo 1, x => 20, y => 300, 4000 },
'Testing: `sub foo(:$n, *%h, *@a){ }; foo 1, x => 20, y => 300, 4000`';
ok (foo1 1, x => 20, y => 300, 4000).notdef,
nok (foo1 1, x => 20, y => 300, 4000).defined,
'Testing value for named argument';
is (foo2 1, x => 20, y => 300, 4000), 320,
'Testing value for slurpy *%h';
Expand Down
4 changes: 2 additions & 2 deletions S06-signature/unspecified.t
Expand Up @@ -20,7 +20,7 @@ sub positional { @_[0] }
is &positional.signature, :(Mu *@_),
'signature is :(Mu *@_) when none is specified and @_ is used';
is positional( 'alpha' ), 'alpha', 'can call sub with positional param used';
ok positional().notdef, 'sub using positional param called with no params';
nok positional().defined, 'sub using positional param called with no params';
dies_ok { positional( :victor<whiskey> ) },
'sub using positional param called with named param';

Expand All @@ -29,7 +29,7 @@ sub named { %_<bravo> }
is &named.signature, :(Mu *%_),
'signature is :(Mu *%_) when none is specified and %_ is used';
is named( :bravo<charlie> ), 'charlie', 'can call sub with named param used';
ok named().notdef, 'named param sub is callable with no params';
nok named().defined, 'named param sub is callable with no params';
dies_ok { named( 'zulu' ) }, 'named param sub dies with positional param';

sub both { @_[1] ~ %_<delta> }
Expand Down
2 changes: 1 addition & 1 deletion S29-context/eval.t
Expand Up @@ -28,7 +28,7 @@ is(eval('$foo'), $foo, 'simple eval using variable defined outside');
# traps die?
ok(!eval('die; 1'), "eval can trap die");

ok(eval('my @a = (1); @a!<0>').notdef, "eval returns undefined on syntax error");
nok(eval('my @a = (1); @a!<0>').defined, "eval returns undefined on syntax error");

ok(!eval('use Poison; 1'), "eval can trap a fatal use statement");

Expand Down
2 changes: 1 addition & 1 deletion S32-list/first.t
Expand Up @@ -40,7 +40,7 @@ my @list = (1 ... 10);
}

{
ok(@list.first( { ($^a == 11) }).notdef, 'first returns undefined unsuccessful match');
nok(@list.first( { ($^a == 11) }).defined, 'first returns undefined unsuccessful match');
}

{
Expand Down
4 changes: 2 additions & 2 deletions S32-num/sign.t
Expand Up @@ -58,8 +58,8 @@ is(sign(NaN),NaN, 'sign of NaN is NaN');
is(sign(:x(-1.5e-1)), -1, 'got the right sign for -1.5e-1');
}

ok sign(Int).notdef, 'sign(Int) is undefined';
ok sign(3+4i).notdef, 'sign(Complex) fails';
nok sign(Int).defined, 'sign(Int) is undefined';
nok sign(3+4i).defined, 'sign(Complex) fails';

done;

Expand Down

0 comments on commit 2544bcf

Please sign in to comment.