# New Ticket Created by Moritz Lenz # Please include the string: [perl #64170] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=64170 >
Spec r25607 changed 'class Foo is also { ... }' to 'augment class Foo { ... }', Rakudo still does it the old way. Attached patch updates the test suite accordingly. (I'll also rename a few test files afterwards, but there's no hurry to do that). Cheers, Moritz
From bf0923c5faf80518cb7d549e733a70cd405088e8 Mon Sep 17 00:00:00 2001 From: Moritz Lenz <mor...@faui2k3.org> Date: Tue, 24 Mar 2009 21:12:46 +0100 Subject: [PATCH] [t/spec] 'is also' on classes is now spelled 'augment class...' --- spec/S02-lexical-conventions/unicode.t | 2 +- .../unicode-whitespace.t | 2 +- spec/S02-whitespace_and_comments/unspace.t | 4 ++-- spec/S04-statements/for.t | 2 +- spec/S10-packages/use-with-class.t | 2 +- spec/S12-attributes/is-also-and-initialization.t | 4 ++-- spec/S12-class/extending-arrays.t | 6 +++--- spec/S12-class/is_also_instead.t | 6 +++--- spec/S12-class/open.t | 12 ++++++------ spec/S12-class/open_closed.t | 8 ++++---- spec/S12-methods/chaining.t | 2 +- spec/integration/rule-in-class-Str.t | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/spec/S02-lexical-conventions/unicode.t b/spec/S02-lexical-conventions/unicode.t index e868524..da146c1 100644 --- a/spec/S02-lexical-conventions/unicode.t +++ b/spec/S02-lexical-conventions/unicode.t @@ -88,6 +88,6 @@ is(try { my $à ¤¦à ¥‚à ¤¸à ¤°à ¤¾ = 2; sub à ¤Ÿà ¥‹à ¤Ÿà ¤² ($x) { $x + 2 }; à ¤Ÿà ¥‹à ¤Ÿà ¤² # Unicode methods { - class Str is also { method äöü { self.ucfirst } }; + augment class Str { method äöü { self.ucfirst } }; is "pugs".äöü(), "Pugs", "Unicode methods"; } diff --git a/spec/S02-whitespace_and_comments/unicode-whitespace.t b/spec/S02-whitespace_and_comments/unicode-whitespace.t index 6069b3f..ef2fa0a 100644 --- a/spec/S02-whitespace_and_comments/unicode-whitespace.t +++ b/spec/S02-whitespace_and_comments/unicode-whitespace.t @@ -125,7 +125,7 @@ myãÂ...@x = <a b c>; sub y (@z) {ãÂ...@z[1] }; y(@x) #Long dot whitespace tests #These currently get different results than the above -class Str is also { +augment class Str { method id() { self } } diff --git a/spec/S02-whitespace_and_comments/unspace.t b/spec/S02-whitespace_and_comments/unspace.t index 8ad66e7..29163ff 100644 --- a/spec/S02-whitespace_and_comments/unspace.t +++ b/spec/S02-whitespace_and_comments/unspace.t @@ -49,7 +49,7 @@ is( ~...@array, "7 8 9", 'unspace with postfix hyperops'); #Test the "unspace" and unspace syntax -class Str is also { +augment class Str { method id($x:) { $x } } @@ -191,7 +191,7 @@ is(eval('baz { @^x }, 1, 2, 3'), (1, 2, 3), 'comma immediately following arg blo is(eval('baz { @^x } , 1, 2, 3'), (1, 2, 3), 'comma not immediately following arg block'); is(eval('baz { @^x }\ , 1, 2, 3'), (1, 2, 3), 'unspace then comma following arg block'); -class Code is also { +augment class Code { method xyzzy(Code $x: *...@y) { $x.(@y) } } diff --git a/spec/S04-statements/for.t b/spec/S04-statements/for.t index 5959fc2..8bf13af 100644 --- a/spec/S04-statements/for.t +++ b/spec/S04-statements/for.t @@ -55,7 +55,7 @@ plan 55; #?rakudo skip 'class accessing outer lexical' { my $d = ''; - class Int is also { + augment class Int { method some_meth_1 { $d = $d ~ self } diff --git a/spec/S10-packages/use-with-class.t b/spec/S10-packages/use-with-class.t index b5e0883..ca22bc0 100644 --- a/spec/S10-packages/use-with-class.t +++ b/spec/S10-packages/use-with-class.t @@ -20,7 +20,7 @@ eval_lives_ok 'Stupid::Class.new()', 'can instantiate object of "imported" class } { - class Stupid::Class is also { + augment class Stupid::Class { method double { $.attrib ~ $.attrib }; } my $o = Stupid::Class.new( attrib => 'd' ); diff --git a/spec/S12-attributes/is-also-and-initialization.t b/spec/S12-attributes/is-also-and-initialization.t index e81d620..ea758b3 100644 --- a/spec/S12-attributes/is-also-and-initialization.t +++ b/spec/S12-attributes/is-also-and-initialization.t @@ -14,11 +14,11 @@ diag('Test for class attribute initialization'); { class T1 { } class T2 { } - ok eval(q{class T1 is also { has $.t = 1 }; 1}), + ok eval(q{augment class T1 { has $.t = 1 }; 1}), "Try to initialize public attribute"; ok eval(q{ - class T2 is also { + augment class T2 { has $!t = 2; method get { $!t }; }; 1 }), diff --git a/spec/S12-class/extending-arrays.t b/spec/S12-class/extending-arrays.t index c3474d3..31d3baa 100644 --- a/spec/S12-class/extending-arrays.t +++ b/spec/S12-class/extending-arrays.t @@ -4,8 +4,8 @@ use Test; plan 11; -class Array is also { method test_method { 1 }; }; -class Hash is also { method test_method { 1 }; }; +augment class Array { method test_method { 1 }; }; +augment class Hash { method test_method { 1 }; }; my @named_array; @@ -48,7 +48,7 @@ my $pair = :key<value>; is $pair.value, 'value', "method on a named pair"; { - class List is also { + augment class List { method twice { gather { take $_ * 2 for self; diff --git a/spec/S12-class/is_also_instead.t b/spec/S12-class/is_also_instead.t index 0e04674..0a7a50a 100644 --- a/spec/S12-class/is_also_instead.t +++ b/spec/S12-class/is_also_instead.t @@ -10,15 +10,15 @@ plan 5; class Foo { method a {'called Foo.a'} } - class Foo is also { + augment class Foo { method b {'called Foo.b'} } my $o = Foo.new; is($o.a, 'called Foo.a', 'basic method call works'); - is($o.b, 'called Foo.b', 'added method call works'); + is($o.b, 'called Foo.b', 'added method call works'); - ok(!eval('class NonExistent is also { }'), 'is also on non-existent class dies'); + ok(!eval('augment class NonExistent { }'), 'augment on non-existent class dies'); } #?rakudo skip 'is instead not yet implemented' diff --git a/spec/S12-class/open.t b/spec/S12-class/open.t index e831c92..50e1f0e 100644 --- a/spec/S12-class/open.t +++ b/spec/S12-class/open.t @@ -14,9 +14,9 @@ my $x = Something.new(attribute => 'b'); is $x.in_Something, 'ab', 'basic OO sanity'; # although we use curlies here to be better fudge-able, remeber -# that 'is also' class extensions are *not* lexically scoped +# that 'augment' class extensions are *not* lexically scoped { - class Something is also { + augment class Something { method later_added { 'later' } @@ -37,7 +37,7 @@ is $x.in_Something, 'ab', 'basic OO sanity'; # now try to extend "core" types { - class Str is also { + augment class Str { method mydouble { self.uc ~ self.lc; } @@ -47,14 +47,14 @@ is $x.in_Something, 'ab', 'basic OO sanity'; } { - class Int is also { + augment class Int { method triple { self * 3 } } is 3.triple, 9, 'can extend Int'; } { - class List is also { + augment class List { method first-and-last { self[0] ~ self[self - 1] } @@ -66,7 +66,7 @@ is $x.in_Something, 'ab', 'basic OO sanity'; } { - class Array is also { + augment class Array { method last-and-first { self[self - 1] ~ self[0] } diff --git a/spec/S12-class/open_closed.t b/spec/S12-class/open_closed.t index 5e3d281..a4908d7 100644 --- a/spec/S12-class/open_closed.t +++ b/spec/S12-class/open_closed.t @@ -14,12 +14,12 @@ 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")'); +lives_ok({augment class Bar {method d {'called Bar.d'}}}, 'adding to opened class lives (using "is open")'); { my $o = Bar.new; @@ -32,7 +32,7 @@ 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)'); + lives_ok({augment class Baz {method f {'called Baz.f'}}}, 'adding to open class lives (lexically scoped pragma)'); my $o = Baz.new; is($o.e, 'called Baz.e', 'old method is still present'); @@ -43,7 +43,7 @@ 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)'); +lives_ok({augment class Qux {method h {'called Qux.i'}}}, 'adding to open class lives (global pragma with class name)'); { my $o = Qux.new; is($o.g, 'called Qux.g', 'old is still present'); diff --git a/spec/S12-methods/chaining.t b/spec/S12-methods/chaining.t index b089628..ce6c815 100644 --- a/spec/S12-methods/chaining.t +++ b/spec/S12-methods/chaining.t @@ -63,7 +63,7 @@ eval_dies_ok('$foo->num', 'Perl 5 -> is dead (method call)'); # L<S12/"Open vs Closed Classes"/"though you have to be explicit"> #?rakudo skip 'parsing [=>]' { - class Pair is also { + augment class Pair { our method car () { self.key; } our Pair method cdr () { self.value; } } diff --git a/spec/integration/rule-in-class-Str.t b/spec/integration/rule-in-class-Str.t index c537bbd..5b178b9 100644 --- a/spec/integration/rule-in-class-Str.t +++ b/spec/integration/rule-in-class-Str.t @@ -22,7 +22,7 @@ class C is Str { is(C.new.meth1(),"worked",'m:P5/[^a]/ in method in C (is Str)'); -class Str is also { +augment class Str { method meth2 () { if ("bar" ~~ m:P5/[^a]/) { "worked"; @@ -34,7 +34,7 @@ class Str is also { is(Str.new.meth2(),"worked",'m:P5/[^a]/ in method in Str'); -class Str is also { +augment class Str { method meth3 () { if ("bar" ~~ m:P5/[a]/) { "worked"; -- 1.5.6.5