Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[t/spec] s/is also/augment/ in open_closed.t

Also get rid of lives_ok { ... } around class defintions; the class
composition happen at compile time anyway, so that was pretty pointless.

git-svn-id: http://svn.pugscode.org/pugs@26755 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 16a04d409fc086231bff2417e10cf149882812b0 1 parent 641a3e0
moritz authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 S12-class/open_closed.t
View
18 S12-class/open_closed.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 12;
+plan 9;
# syn r14552
@@ -14,14 +14,14 @@ class Foo {
method a {'called Foo.a'}
}
-eval_dies_ok('class Foo is also {method b {"called Foo.b"}}}', 'adding to closed class dies');
+eval_dies_ok('augment class Foo {method b {"called Foo.b"}}}', 'adding to closed class dies');
class Bar is open {
method c {'called Bar.c'}
}
-lives_ok({class Bar is also {method d {'called Bar.d'}}}, 'adding to opened class lives (using "is open")');
-
-{
+augment class Bar {
+ method d {'called Bar.d'}
+}
my $o = Bar.new;
is($o.c, 'called Bar.c', 'old method is still present');
is($o.d, 'called Bar.d', 'new method is also present');
@@ -32,7 +32,9 @@ lives_ok({class Bar is also {method d {'called Bar.d'}}}, 'adding to opened clas
# this seems weird to me.
use class :open;
class Baz {method e {'called Baz.e'}}
- lives_ok({class Baz is also {method f {'called Baz.f'}}}, 'adding to open class lives (lexically scoped pragma)');
+ augment class Baz {
+ method f {'called Baz.f'}
+ }
my $o = Baz.new;
is($o.e, 'called Baz.e', 'old method is still present');
@@ -43,8 +45,10 @@ lives_ok({class Bar is also {method d {'called Bar.d'}}}, 'adding to opened clas
# and just when you thought I ran out of generic identifiers
use class :open<Qux>;
class Qux {method g {'called Qux.g'}}
-lives_ok({class Qux is also {method h {'called Qux.i'}}}, 'adding to open class lives (global pragma with class name)');
{
+ augment class Qux {
+ method h {'called Qux.i'}
+ }
my $o = Qux.new;
is($o.g, 'called Qux.g', 'old is still present');
is($o.h, 'called Qux.h', 'new method is present as well');
Please sign in to comment.
Something went wrong with that request. Please try again.