Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 23 lines (17 sloc) 0.435 kb
530e7f1 [t] move blocks/splat_rw.t to spec/
moritz authored
1 use v6;
2
3 use Test;
4
ac30e28 Tobias Leich added a second variable to the sub call
FROGGS authored
5 plan 3;
530e7f1 [t] move blocks/splat_rw.t to spec/
moritz authored
6
7 # test splatted parameter for rw ability
ac30e28 Tobias Leich added a second variable to the sub call
FROGGS authored
8 # L<S06/"Parameter traits"/"is rw">
530e7f1 [t] move blocks/splat_rw.t to spec/
moritz authored
9
10 my @test = 1..5;
ac30e28 Tobias Leich added a second variable to the sub call
FROGGS authored
11 my $test = 42;
1af085a [t/spec]
moritz authored
12 lives_ok {
530e7f1 [t] move blocks/splat_rw.t to spec/
moritz authored
13 my sub should_work ( *@list is rw ) {
ac30e28 Tobias Leich added a second variable to the sub call
FROGGS authored
14 @list[0] = "hi";
15 @list[*-1] = "ho";
530e7f1 [t] move blocks/splat_rw.t to spec/
moritz authored
16 }
ac30e28 Tobias Leich added a second variable to the sub call
FROGGS authored
17 should_work(@test, $test);
1af085a [t/spec]
moritz authored
18 }, "trying to use an 'is rw' splat does work out";
19 is(@test[0], "hi", "@test was changed");
ac30e28 Tobias Leich added a second variable to the sub call
FROGGS authored
20 is($test, "ho", '$test was changed');
530e7f1 [t] move blocks/splat_rw.t to spec/
moritz authored
21
22 # vim: ft=perl6
Something went wrong with that request. Please try again.