Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 59 lines (49 sloc) 2.059 kb
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
1 use v6;
2 use Test;
3
d2482f4 replace plan *; with number of tests S03-S06
mberends authored
4 plan 17;
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
5
e27dccc [t/spec] smartlinks and a simplification
moritz authored
6 # L<S06/Perl5ish subroutine declarations/You can declare a sub without
7 # parameter list>
f1d90ff Moritz Lenz avoid using typed slurpy for unrelated things
moritz authored
8 #
9 # TODO: stop using is() to compare signatures, their stringification
10 # isn't specced
e27dccc [t/spec] smartlinks and a simplification
moritz authored
11
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
12 sub simple { 'simple' }
b1a65f0 lizmat Unfudges, skip -> todo and other clarifications in S06 testing
lizmat authored
13 #?rakudo todo 'siglist'
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
14 is &simple.signature, :(), 'signature is :() when none is specified';
15 is simple(), 'simple', 'can call sub with no signature specified';
04daf2d Tobias Leich eval => EVAL in S05, S06 and S09
FROGGS authored
16 dies_ok { EVAL('simple( :golf<hotel> )') },
ea5588e [t/spec] improved readability/clarity after comments from TimToady++
kyle authored
17 'sub with no signature dies when given a named argument';
04daf2d Tobias Leich eval => EVAL in S05, S06 and S09
FROGGS authored
18 dies_ok { EVAL("simple( 'india' )") },
ea5588e [t/spec] improved readability/clarity after comments from TimToady++
kyle authored
19 'sub with no signature dies when given positional argument';
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
20
21 sub positional { @_[0] }
b1a65f0 lizmat Unfudges, skip -> todo and other clarifications in S06 testing
lizmat authored
22 #?rakudo todo 'siglist'
f1d90ff Moritz Lenz avoid using typed slurpy for unrelated things
moritz authored
23 is &positional.signature, :(*@_),
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
24 'signature is :(Mu *@_) when none is specified and @_ is used';
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
25 is positional( 'alpha' ), 'alpha', 'can call sub with positional param used';
2544bcf Jeff Horelick Remove most remaining .notdef's.
jdhore authored
26 nok positional().defined, 'sub using positional param called with no params';
d4509d1 [t/spec] bring unspecified.t closer to my understanding of the spec
moritz authored
27 dies_ok { positional( :victor<whiskey> ) },
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
28 'sub using positional param called with named param';
29
30 sub named { %_<bravo> }
b1a65f0 lizmat Unfudges, skip -> todo and other clarifications in S06 testing
lizmat authored
31 #?rakudo todo 'siglist'
f1d90ff Moritz Lenz avoid using typed slurpy for unrelated things
moritz authored
32 is &named.signature, :(*%_),
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
33 'signature is :(Mu *%_) when none is specified and %_ is used';
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
34 is named( :bravo<charlie> ), 'charlie', 'can call sub with named param used';
2544bcf Jeff Horelick Remove most remaining .notdef's.
jdhore authored
35 nok named().defined, 'named param sub is callable with no params';
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
36 dies_ok { named( 'zulu' ) }, 'named param sub dies with positional param';
37
38 sub both { @_[1] ~ %_<delta> }
b1a65f0 lizmat Unfudges, skip -> todo and other clarifications in S06 testing
lizmat authored
39 #?rakudo todo 'siglist'
f1d90ff Moritz Lenz avoid using typed slurpy for unrelated things
moritz authored
40 is &both.signature, :(*@_, *%_),
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
41 'signature is :(Mu *@_, Mu *%_) when none is specified and @_ and %_ are used';
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
42 is both( 'x', :delta<echo>, 'foxtrot' ), 'foxtrotecho',
43 'can call sub with both named and positional params used';
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
44 is both(), '',
8c7f047 [t/spec] Tests for P5 style subs without signatures
kyle authored
45 'sub using both named and position params works with no params';
8549842 [t/spec] avoid warnings in unspecified.t
moritz authored
46
25668e6 Will Coleda Prefer RT #XXXXXX
coke authored
47 # RT #71112
2ce2e07 [t/spec] Test for RT 71112: Cannot assign to readonly variable.
kyle authored
48 {
49 sub rt71112 { @_[0] = 'bug' }
50 my $tender = 'sanity';
25668e6 Will Coleda Prefer RT #XXXXXX
coke authored
51 #?rakudo todo 'RT #71112: Cannot assign to readonly variable.'
2ce2e07 [t/spec] Test for RT 71112: Cannot assign to readonly variable.
kyle authored
52 dies_ok { rt71112( $tender ) }, 'Sub that tries to modify @_ dies';
53 is $tender, 'sanity', 'The variable passed is unchanged.';
54 }
55
e76dd4c Moritz Lenz s/done_testing/done/ as per recent S24 changes
moritz authored
56 done;
2ce2e07 [t/spec] Test for RT 71112: Cannot assign to readonly variable.
kyle authored
57
8549842 [t/spec] avoid warnings in unspecified.t
moritz authored
58 # vim: ft=perl6
Something went wrong with that request. Please try again.