Skip to content

Commit 9b8425a

Browse files
committed
tests for native attribute BUILDPLAN.
1 parent cc153df commit 9b8425a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

S12-construction/construction.t

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 15;
5+
plan 18;
66

77
# L<S12/"Construction and Initialization">
88

@@ -88,4 +88,19 @@ is Foo.new("a string").a, 'a string', "our own 'new' was called";
8888
is MonkeyNew.new().x, 'called', 'monkey-typed .new() method is called';
8989
}
9090

91+
{
92+
class NativeInt {
93+
has int $.attr;
94+
}
95+
lives_ok -> { NativeInt.new(:attr(123)) }, ".new with a native int attribute";
96+
class NativeNum {
97+
has num $.attr;
98+
}
99+
lives_ok -> { NativeNum.new(:attr(0e0)) }, ".new with a native num attribute";
100+
class NativeStr {
101+
has str $.attr;
102+
}
103+
lives_ok -> { NativeStr.new(:attr<foo>) }, ".new with a native str attribute";
104+
}
105+
91106
# vim: ft=perl6

0 commit comments

Comments
 (0)