Permalink
Browse files

start to remove .notdef

  • Loading branch information...
1 parent b6cb10e commit 08f1960319bb0aec3a7b0c2fdd8f0310b34174ef @moritz moritz committed Feb 23, 2011
@@ -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');
View
@@ -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
View
@@ -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';
@@ -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';
@@ -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,
@@ -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
@@ -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
@@ -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>
@@ -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';
@@ -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");

0 comments on commit 08f1960

Please sign in to comment.