|
Revision 21719, 0.9 kB
(checked in by lwall, 5 months ago)
|
|
[STD] detect obsolete use of =cut
[t/*.t] delete obsolete uses of =cut
|
-
Property svn:mime-type set to
text/plain; charset=UTF-8
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | use v6; |
|---|
| 2 | |
|---|
| 3 | use Test; |
|---|
| 4 | |
|---|
| 5 | plan 2; |
|---|
| 6 | |
|---|
| 7 | =begin pod |
|---|
| 8 | |
|---|
| 9 | This code shows the bug: |
|---|
| 10 | pugs -e 'my @a = ("one", "two", "three"); sub foo (@a) { my $t = any(@a).pick(); say WHAT($t); say $t }; foo(@a)' |
|---|
| 11 | |
|---|
| 12 | prints out: |
|---|
| 13 | Array |
|---|
| 14 | one two three |
|---|
| 15 | |
|---|
| 16 | But this code: |
|---|
| 17 | pugs -e 'my @a = ("one", "two", "three"); my $t = any(@a).pick(); say WHAT($t); say $t' |
|---|
| 18 | |
|---|
| 19 | prints out: |
|---|
| 20 | Str |
|---|
| 21 | ("one" "two" or "three") |
|---|
| 22 | |
|---|
| 23 | And this code: |
|---|
| 24 | pugs -e 'sub foo2 { any(1 .. 10).pick() }; say WHAT(foo2());' |
|---|
| 25 | |
|---|
| 26 | prints out: |
|---|
| 27 | Int |
|---|
| 28 | |
|---|
| 29 | sub foo (@a) { my $t = any(@a).pick(); say WHAT($t); say $t }; foo(1..3) |
|---|
| 30 | succeeds: |
|---|
| 31 | Int |
|---|
| 32 | 2 |
|---|
| 33 | |
|---|
| 34 | my @b = (1..3); sub foo (@a) { my $t = any(@a).pick(); say WHAT($t); say $t }; foo(*@b); |
|---|
| 35 | succeeds: |
|---|
| 36 | Int |
|---|
| 37 | 3 |
|---|
| 38 | |
|---|
| 39 | =end pod |
|---|
| 40 | |
|---|
| 41 | my @test_string = ("one", "two", "three"); |
|---|
| 42 | my @test_int = 1 .. 10; |
|---|
| 43 | |
|---|
| 44 | sub foo (@a) { any(@a).pick() } |
|---|
| 45 | |
|---|
| 46 | isa_ok(foo(@test_string), 'Str'); |
|---|
| 47 | isa_ok(foo(@test_int), 'Int'); |
|---|