Skip to content

Commit

Permalink
Add release notes and extra test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ashb committed Mar 1, 2009
1 parent 3522bc6 commit 4720bf4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Changes
@@ -1,5 +1,10 @@
Changelog for Parse::Method::Signatures

1.003000 -
- Port to using PPI to do the parsing
- Produces nicer error messages
- Refactor internals to be much more readable (thanks to Piers Cawley)

1.002000 - 2009/02/21
- Will now build a Moose TC object for types of params
- Add a few more docs
Expand Down
3 changes: 1 addition & 2 deletions lib/Parse/Method/Signatures.pm
Expand Up @@ -11,8 +11,7 @@ use Parse::Method::Signatures::Types qw/PositionalParam NamedParam UnpackedParam
use Carp qw/croak/;

use namespace::clean -except => 'meta';

our $VERSION = '1.002000';
our $VERSION = '1.003000';
our $ERROR_LEVEL = 0;
our %LEXTABLE;
our $DEBUG = $ENV{PMS_DEBUG} || 0;
Expand Down
5 changes: 5 additions & 0 deletions t/ppi.t
Expand Up @@ -132,6 +132,11 @@ test_param(
}
);

throws_ok {
Parse::Method::Signatures->new('($x = 0xfG)')->signature(),
} qr/^'\)' expected whilst parsing signature near 'G' in '\$x = 0xfG' at/,
q/')' expected whilst paring signautre near 'G' in '$x = 0xfG' at/;

test_param(
$param->params->[0],
{ required => 0,
Expand Down
10 changes: 10 additions & 0 deletions t/signatures.t
Expand Up @@ -69,6 +69,7 @@ my @sigs = (
['([$y, $z, @rest], :$x)', 'array ref unpacking combined with named'],
['(:foo([$x, $y, @rest]))', 'named array ref unpacking'],
['({%x})', 'hash ref unpacking into hash'],
['(:foo({%x}))', 'labeld hash ref unpacking into hash'],
['({:$x, :$y, %rest})', 'hash ref unpacking into scalars and hash'],
['($x, {:$y, :$z, %rest})', 'hash ref unpacking combined with normal positionals'],
['({:$y, :$z, %rest}, $x)', 'hash ref unpacking combined with normal positionals'],
Expand All @@ -88,6 +89,8 @@ my @sigs = (
['($x = q"fo)o")', 'string default'],
['($x = [ ])', 'simple array default'],
['($x = { })', 'simple hash default'],
['($x = 0xf)', 'hex default'],
['($x = 0xfF)', 'hex default'],
);

my @alternative = (
Expand Down Expand Up @@ -127,6 +130,13 @@ my @invalid = (
['($foo is bar moo is bo)', 'invalid traits'],
['(Foo:: Bar $foo)', 'invalid spaces in TC'],
['(Foo ::Bar $foo)', 'invalid spaces in TC'],
['(@y: $foo)', 'invalid invocant'],
['(@y,)', 'trailing comma'],
['($x where [ foo ])', 'no block after where'],
['($x does $x)', 'invalid param trait'],
['(:foo(Str $x))', 'invalid label contents'],
# This should probably be valid
['($x = $a[0])', 'invalid label contents'],
);

plan tests => scalar @sigs * 3 + scalar @alternative + scalar @invalid;
Expand Down

0 comments on commit 4720bf4

Please sign in to comment.