Skip to content

Commit 98bdc2d

Browse files
committed
Test pointy blocks with definite returns.
Already worked, but didn't see any tests for it.
1 parent 80ba7dc commit 98bdc2d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

S06-signature/definite-return.t

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

33
use Test;
44

5-
plan 17;
5+
plan 19;
66

77
# L<S06/Signatures>
88

@@ -122,6 +122,16 @@ constant indiana-pi = 3;
122122
is return-fifteen(), indiana-pi, 'can return indiana-pi';
123123
}
124124

125+
{
126+
my $pointy = -> --> 42 { };
127+
is $pointy(), 42, 'pointy can have definite return type that is an integer';
128+
}
129+
130+
{
131+
my $pointy = -> --> Nil { sin(1) };
132+
ok $pointy() === Nil, 'pointy can have definite return type of Nil';
133+
}
134+
125135
# returns vs -->
126136
# indefinite vs immutable vs mutable
127137
# what are some wacky immutable values that we could return? (*)

0 commit comments

Comments
 (0)