Skip to content

Commit

Permalink
Test that all parents' attributes are set with .new
Browse files Browse the repository at this point in the history
This addresses the remaining piece of R#1679.
  • Loading branch information
ab5tract committed May 21, 2024
1 parent 4e23615 commit 3434882
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion S12-construction/construction.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use Test;

plan 21;
plan 22;

# L<S12/"Construction and Initialization">

Expand Down Expand Up @@ -131,4 +131,20 @@ is Foo.new("a string").a, 'a string', "our own 'new' was called";
lives-ok { A.new }, 'can we create with a custom "bless" method';
}

# https://github.com/rakudo/rakudo/issues/1679
subtest "all parents' attributes are set with .new" => {
plan 3;
my class A { has @.a }
my class B { has @.b }
my class C { has @.c }
my class D is A is B {}
my class E is D is C {}

with E.new: :a<a b c>, :b<d e f>, :c<g h i> {
is-deeply .a, [<a b c>], 'ancestor 1';
is-deeply .b, [<d e f>], 'ancestor 2';
is-deeply .c, [<g h i>], 'parent';
}
}

# vim: expandtab shiftwidth=4

0 comments on commit 3434882

Please sign in to comment.