Skip to content

Commit

Permalink
start to remove .notdef
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Feb 23, 2011
1 parent b6cb10e commit 08f1960
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion S03-operators/increment.t
Expand Up @@ -19,7 +19,7 @@ is($a++, 0, 'Mu++ == 0');

$a = Mu;
#?rakudo skip 'unimpl Mu--'
ok(notdef($a--), 'Mu-- is undefined');
nok(defined($a--), 'Mu-- is undefined');

$a = 'x';
is($a++, 'x', 'magical ++ should not be numified');
Expand Down
2 changes: 1 addition & 1 deletion S04-declarations/my.t
Expand Up @@ -166,7 +166,7 @@ is(eval('loop (my $x = 1, my $y = 2; $x > 0; $x--) { last }; $y'), 2, '2nd my in
my $z = 42;
{
my $z = $z;
ok( $z.notdef, 'my $z = $z; can not see the value of the outer $z');
nok( $z.defined, 'my $z = $z; can not see the value of the outer $z');
}

# interaction of my and eval
Expand Down
6 changes: 3 additions & 3 deletions S04-phasers/start.t
Expand Up @@ -26,7 +26,7 @@ plan 21;
my $var;
my $sub = sub ($x) { START { $var += $x } };

ok $var.notdef, 'START {...} has not run yet';
nok $var.defined, 'START {...} has not run yet';

$sub(2);
is $var, 2, 'START {} has executed';
Expand Down Expand Up @@ -86,7 +86,7 @@ for <first second> {
$var;
};

ok $was_in_start.notdef, 'START {} has not run yet';
nok $was_in_start.defined, 'START {} has not run yet';
is $sub(), 23, 'START {} block set our variable (2)';
is $sub(), 23, 'the returned value of START {} still there';
is $was_in_start, 1, 'our START {} block was invoked exactly once';
Expand All @@ -98,7 +98,7 @@ for <first second> {
my $was_in_start;
my $sub = { START { $was_in_start++; Mu } };

ok $sub().notdef, 'START {} returned undefined';
nok $sub().defined, 'START {} returned undefined';
$sub();
$sub();
is $was_in_start, 1,
Expand Down
2 changes: 1 addition & 1 deletion S06-advanced_subroutine_features/return.t
Expand Up @@ -55,7 +55,7 @@ is( @l, [], "A bare return is an empty list in array/list context");
my $s = "hello";
$s = bare_return();

ok($s.notdef, "A bare return is undefined in scalar context");
nok($s.defined, "A bare return is undefined in scalar context");

## scalars

Expand Down
2 changes: 1 addition & 1 deletion S12-attributes/delegation.t
Expand Up @@ -153,7 +153,7 @@ class PairTest {
dies_ok { $t.c = 'foo' }, '... but only to lvaues attributes';
is $t.a, 'foo', 'assignment worked';
is $t.backend.a, 'foo', 'can also query that through the backend';
ok $t.c.notdef, 'died assignment had no effect';
nok $t.c.defined, 'died assignment had no effect';
}

# arrays, hashes
Expand Down
6 changes: 3 additions & 3 deletions S12-attributes/instance.t
Expand Up @@ -25,8 +25,8 @@ class Foo1 { has $.bar; };
$val = $foo.can("bar")
}, '.. checking autogenerated accessor existence';
ok($val, '... $foo.can("bar") should have returned true');
ok($foo.bar().notdef, '.. autogenerated accessor works');
ok($foo.bar.notdef, '.. autogenerated accessor works w/out parens');
nok($foo.bar().defined, '.. autogenerated accessor works');
nok($foo.bar.defined, '.. autogenerated accessor works w/out parens');
}

# L<S12/Attributes/Pseudo-assignment to an attribute declaration specifies the default>
Expand Down Expand Up @@ -54,7 +54,7 @@ class Foo1 { has $.bar; };
$val = $foo.can("bar");
}, '.. checking autogenerated accessor existence';
ok $val, '... $foo.can("bar") should have returned true';
ok($foo.bar().notdef, '.. autogenerated accessor works');
nok($foo.bar().defined, '.. autogenerated accessor works');
lives_ok {
$foo.bar = "baz";
}, '.. autogenerated mutator as lvalue works';
Expand Down
2 changes: 1 addition & 1 deletion S12-attributes/mutators.t
Expand Up @@ -25,7 +25,7 @@ my $lvm = LValueMutator.new(:foo(3));
# which in turns initializes the attributes directly
#?rakudo todo 'OO (test needs review)'
is($lvm.foo, 3, "constructor uses lvalue accessor method");
ok($lvm.get_foo.notdef, "constructor doesn't simply set attributes");
nok($lvm.get_foo.defined, "constructor doesn't simply set attributes");

lives_ok { $lvm.get_foo = 6 }, "lvalue accessors seem to work";
is($lvm.get_foo, 6, "lvalue accessors work");
Expand Down

0 comments on commit 08f1960

Please sign in to comment.