Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test documentation of anonymous parameters
  • Loading branch information
hoelzro committed Jul 25, 2014
1 parent f6b14c5 commit 329d202
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
12 changes: 11 additions & 1 deletion S26-documentation/why-both.t
@@ -1,5 +1,5 @@
use Test;
plan 54;
plan 55;

#| simple case
class Simple {
Expand Down Expand Up @@ -125,3 +125,13 @@ is $param.WHY.trailing, "first param";

$param = &so-many-params.signature.params[1];
ok !$param.WHY.defined, 'the second parameter has no comments' or diag($param.WHY.content);

sub has-anon-param(
#| leading
Str $
#= trailing
) {}

$param = &has-anon-param.signature.params[0];

is $param.WHY, "leading\ntrailing", 'anonymous parameters should work';
11 changes: 10 additions & 1 deletion S26-documentation/why-leading.t
@@ -1,5 +1,5 @@
use Test;
plan 96;
plan 97;

#| simple case
class Simple {
Expand Down Expand Up @@ -186,3 +186,12 @@ is &both-documented.signature.params[1].WHY, 'I too, am documented';
ok &both-documented.signature.params[1].WHY.WHEREFORE === &both-documented.signature.params[1], 'param WHEREFORE matches';
is &both-documented.signature.params[1].WHY.leading, 'I too, am documented';
ok !&both-documented.signature.params[1].WHY.trailing.defined;

sub has-anon-param(
#| leading
Str $
) {}

my $param = &has-anon-param.signature.params[0];

is $param.WHY, 'leading', 'anonymous parameters should work';
11 changes: 10 additions & 1 deletion S26-documentation/why-trailing.t
@@ -1,5 +1,5 @@
use Test;
plan 83;
plan 84;

class Simple {
#= simple case
Expand Down Expand Up @@ -168,3 +168,12 @@ ok !$param.WHY.leading.defined;

$param = &so-many-params.signature.params[1];
ok !$param.WHY.defined, 'the second parameter has no comments' or diag($param.WHY.content);

sub has-anon-param(
Str $
#= trailing
) {}

$param = &has-anon-param.signature.params[0];

is $param.WHY, 'trailing', 'anonymous parameters should work';

0 comments on commit 329d202

Please sign in to comment.