This is an automated email from the git hooks/post-receive script. js pushed a commit to tag PEVANS in repository libparser-mgc-perl.
commit ffbd64443bcff6ce2c8bcde21344276f9018b581 Author: Paul Evans <leon...@leonerd.org.uk> Date: Sun Sep 1 00:34:57 2013 +0000 Import of PEVANS/Parser-MGC-0.12 from CPAN. gitpan-cpan-distribution: Parser-MGC gitpan-cpan-version: 0.12 gitpan-cpan-path: PEVANS/Parser-MGC-0.12.tar.gz gitpan-cpan-author: PEVANS gitpan-cpan-maturity: released --- Build.PL | 2 +- Changes | 7 +++++++ LICENSE | 6 +++--- META.json | 8 ++++---- META.yml | 8 ++++---- Makefile.PL | 4 ++-- README | 11 ++++++++++- examples/parse-xml.pl | 5 ++--- lib/Parser/MGC.pm | 23 ++++++++++++++++++----- t/00use.t | 9 ++++++++- t/01base.t | 7 +++++-- t/02expect.t | 26 ++++++++++++++++++++++++-- t/03reader.t | 7 +++++-- t/04where.t | 7 +++++-- t/05comment.t | 7 +++++-- t/06substring.t | 7 +++++-- t/07generic_token.t | 7 +++++-- t/10token_int.t | 7 +++++-- t/11token_float.t | 7 +++++-- t/12token_number.t | 7 +++++-- t/13token_string.t | 7 +++++-- t/14token_ident.t | 7 +++++-- t/15token_kw.t | 7 +++++-- t/20maybe.t | 7 +++++-- t/21scope_of.t | 7 +++++-- t/22list_of.t | 7 +++++-- t/23sequence_of.t | 7 +++++-- t/24any_of.t | 7 +++++-- t/30commit.t | 7 +++++-- t/31scope_level.t | 7 +++++-- t/32exception.t | 7 +++++-- t/90ex_dict.t | 7 +++++-- t/90ex_expr.t | 3 ++- t/90ex_pod.t | 7 +++++-- t/90ex_synopsis.t | 7 +++++-- t/90ex_xml.t | 5 ++++- t/98backcompat.t | 7 +++++-- t/99pod.t | 5 ++++- 38 files changed, 213 insertions(+), 77 deletions(-) diff --git a/Build.PL b/Build.PL index e8ef8db..c76839c 100644 --- a/Build.PL +++ b/Build.PL @@ -10,7 +10,7 @@ my $build = Module::Build->new( }, build_requires => { 'File::Temp' => 0, - 'Test::More' => 0, + 'Test::More' => '0.88', # done_testing }, auto_configure_requires => 0, # Don't add M::B to configure_requires license => 'perl', diff --git a/Changes b/Changes index b9c8306..d9176c7 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,12 @@ Revision history for Parser-MGC +0.12 2013/09/01 01:30:13 + [CHANGES] + * Ensure that ->expect / ->maybe_expect with optional capture groups + don't yield warnings (thanks BP Jonsson) + * Allow setting binmode for ->from_file + * Slightly neater examples/parse-xml.pl + 0.11 CHANGES: * Allow different toplevel parse methods to the constructor * Added another example showing parsing XML - only a minimal example; diff --git a/LICENSE b/LICENSE index 6e7c191..607fe2e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -This software is copyright (c) 2012 by Paul Evans <leon...@leonerd.org.uk>. +This software is copyright (c) 2013 by Paul Evans <leon...@leonerd.org.uk>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2012 by Paul Evans <leon...@leonerd.org.uk>. +This software is Copyright (c) 2013 by Paul Evans <leon...@leonerd.org.uk>. This is free software, licensed under: @@ -272,7 +272,7 @@ That's all there is to it! --- The Artistic License 1.0 --- -This software is Copyright (c) 2012 by Paul Evans <leon...@leonerd.org.uk>. +This software is Copyright (c) 2013 by Paul Evans <leon...@leonerd.org.uk>. This is free software, licensed under: diff --git a/META.json b/META.json index 0112d41..90fd0d2 100644 --- a/META.json +++ b/META.json @@ -4,7 +4,7 @@ "Paul Evans <leon...@leonerd.org.uk>" ], "dynamic_config" : 1, - "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.120630", + "generated_by" : "Module::Build version 0.4005, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], @@ -17,7 +17,7 @@ "build" : { "requires" : { "File::Temp" : "0", - "Test::More" : "0" + "Test::More" : "0.88" } }, "runtime" : { @@ -29,7 +29,7 @@ "provides" : { "Parser::MGC" : { "file" : "lib/Parser/MGC.pm", - "version" : "0.11" + "version" : "0.12" } }, "release_status" : "stable", @@ -38,5 +38,5 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "0.11" + "version" : "0.12" } diff --git a/META.yml b/META.yml index 156c6a2..51f1c7d 100644 --- a/META.yml +++ b/META.yml @@ -4,9 +4,9 @@ author: - 'Paul Evans <leon...@leonerd.org.uk>' build_requires: File::Temp: 0 - Test::More: 0 + Test::More: 0.88 dynamic_config: 1 -generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.120630' +generated_by: 'Module::Build version 0.4005, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -15,9 +15,9 @@ name: Parser-MGC provides: Parser::MGC: file: lib/Parser/MGC.pm - version: 0.11 + version: 0.12 requires: File::Slurp: 0 resources: license: http://dev.perl.org/licenses/ -version: 0.11 +version: 0.12 diff --git a/Makefile.PL b/Makefile.PL index 7ac14ba..e3fcfbc 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,4 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.3800 +# Note: this file was auto-generated by Module::Build::Compat version 0.4005 use ExtUtils::MakeMaker; WriteMakefile ( @@ -7,7 +7,7 @@ WriteMakefile 'PREREQ_PM' => { 'File::Slurp' => 0, 'File::Temp' => 0, - 'Test::More' => 0 + 'Test::More' => '0.88' }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], diff --git a/README b/README index 7842e5f..a010981 100644 --- a/README +++ b/README @@ -94,10 +94,19 @@ METHODS Parse the given literal string and return the result from the toplevel method. - $result = $parser->from_file( $file ) + $result = $parser->from_file( $file, %opts ) Parse the given file, which may be a pathname in a string, or an opened IO handle, and return the result from the toplevel method. + The following options are recognised: + + binmode => STRING + If set, applies the given binmode to the filehandle before + reading. Typically this can be used to set the encoding of the + file. + + $parser->from_file( $file, binmode => ":encoding(UTF-8)" ) + $result = $parser->from_reader( \&reader ) Parse the input which is read by the `reader' function. This function will be called in scalar context to generate portions of string to diff --git a/examples/parse-xml.pl b/examples/parse-xml.pl index 5277017..a3d1eb3 100644 --- a/examples/parse-xml.pl +++ b/examples/parse-xml.pl @@ -58,7 +58,6 @@ sub parse_element $self->commit; - my $node = bless [ node => $tag->{name}, $tag->{attrs} ], "XmlParser::Node"; return XmlParser::Node::Element->new( $tag->{name}, $tag->{attrs} ) if $tag->{selfclose}; my $childlist = $self->sequence_of( \&parse_node ); @@ -76,14 +75,14 @@ sub parse_tag $self->expect( '<' ); my $tagname = $self->token_ident; - my @attrs = @{ $self->sequence_of( \&parse_tag_attr ) }; + my $attrs = $self->sequence_of( \&parse_tag_attr ); my $selfclose = $self->maybe_expect( '/' ); $self->expect( '>' ); return { name => $tagname, - attrs => { map { ( $_->[0], $_->[1] ) } @attrs }, + attrs => { map { ( $_->[0], $_->[1] ) } @$attrs }, selfclose => $selfclose, }; } diff --git a/lib/Parser/MGC.pm b/lib/Parser/MGC.pm index f1cac25..d1bceea 100644 --- a/lib/Parser/MGC.pm +++ b/lib/Parser/MGC.pm @@ -8,7 +8,7 @@ package Parser::MGC; use strict; use warnings; -our $VERSION = '0.11'; +our $VERSION = '0.12'; use Carp; @@ -202,21 +202,34 @@ sub from_string return $result; } -=head2 $result = $parser->from_file( $file ) +=head2 $result = $parser->from_file( $file, %opts ) Parse the given file, which may be a pathname in a string, or an opened IO handle, and return the result from the toplevel method. +The following options are recognised: + +=over 8 + +=item binmode => STRING + +If set, applies the given binmode to the filehandle before reading. Typically +this can be used to set the encoding of the file. + + $parser->from_file( $file, binmode => ":encoding(UTF-8)" ) + +=back + =cut sub from_file { my $self = shift; - my ( $filename ) = @_; + my ( $filename, %opts ) = @_; $self->{filename} = $filename; - $self->from_string( scalar(slurp $filename) ); + $self->from_string( scalar( slurp $filename, binmode => $opts{binmode} ) ); } =head2 $result = $parser->from_reader( \&reader ) @@ -713,7 +726,7 @@ sub maybe_expect $self->{str} =~ m/\G$expect/gc or return; return substr( $self->{str}, $-[0], $+[0]-$-[0] ) if !wantarray; - return map { substr( $self->{str}, $-[$_], $+[$_]-$-[$_] ) } 0 .. $#+; + return map { defined $-[$_] ? substr( $self->{str}, $-[$_], $+[$_]-$-[$_] ) : undef } 0 .. $#+; } sub expect diff --git a/t/00use.t b/t/00use.t index d2dc1c4..97b337d 100644 --- a/t/00use.t +++ b/t/00use.t @@ -1,3 +1,10 @@ -use Test::More tests => 1; +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; use_ok( "Parser::MGC" ); + +done_testing; diff --git a/t/01base.t b/t/01base.t index 6efca79..7220626 100644 --- a/t/01base.t +++ b/t/01base.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 4; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -32,5 +33,7 @@ $tokens = $parser->from_file( \*DATA ); is_deeply( $tokens, [ 4, 5, 6 ], '->from_file(\*DATA)' ); +done_testing; + __DATA__ 4 5 6 diff --git a/t/02expect.t b/t/02expect.t index ec9efba..9aae7d4 100644 --- a/t/02expect.t +++ b/t/02expect.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 7; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -29,6 +30,13 @@ sub parse_foo_or_bar $self->maybe_expect( qr/bar/i ); } +sub parse_numrange +{ + my $self = shift; + + return [ ( $self->maybe_expect( qr/(\d+)(?:-(\d+))?/ ) )[1,2] ]; +} + package main; my $parser = TestParser->new( toplevel => "parse_hello" ); @@ -60,3 +68,17 @@ $parser = TestParser->new( toplevel => "parse_foo_or_bar" ); is( $parser->from_string( "Foo" ), "Foo", "FooBar parser first case" ); is( $parser->from_string( "Bar" ), "Bar", "FooBar parser first case" ); + +$parser = TestParser->new( toplevel => "parse_numrange" ); + +is_deeply( $parser->from_string( "123-456" ), [ 123, 456 ], "Number range parser complete" ); + +{ + my $warnings = ""; + local $SIG{__WARN__} = sub { $warnings .= join "", @_ }; + + is_deeply( $parser->from_string( "789" ), [ 789, undef ], "Number range parser lacking max" ); + is( $warnings, "", "Number range lacking max yields no warnings" ); +} + +done_testing; diff --git a/t/03reader.t b/t/03reader.t index 5118fc8..b7b9d3d 100644 --- a/t/03reader.t +++ b/t/03reader.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 1; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -30,3 +31,5 @@ my @strings = ( is_deeply( $parser->from_reader( sub { return shift @strings } ), [qw( here is a list of some more tokens )], 'tokens from reader' ); + +done_testing; diff --git a/t/04where.t b/t/04where.t index 1dec1fd..94da6e2 100644 --- a/t/04where.t +++ b/t/04where.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 12; +use Test::More; my @positions; my @wheres; @@ -57,3 +58,5 @@ $parser->from_string( "hello world" ); [ 1, 5, "hello" ], [ 2, 5, "world" ], ); $parser->from_string( "hello\nworld" ); + +done_testing; diff --git a/t/05comment.t b/t/05comment.t index a95f780..f3a4462 100644 --- a/t/05comment.t +++ b/t/05comment.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 4; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -30,3 +31,5 @@ $parser = TestParser->new( ); ok( $parser->from_string( "hello\n# Comment\nworld" ), '"hello world" with comment passes' ); + +done_testing; diff --git a/t/06substring.t b/t/06substring.t index 8d76371..4435fdf 100644 --- a/t/06substring.t +++ b/t/06substring.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 2; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -25,3 +26,5 @@ is_deeply( $parser->from_string( "Hello, world!" ), is_deeply( $parser->from_string( "!" ), [ "", "!" ], '"Hello, world!"' ); + +done_testing; diff --git a/t/07generic_token.t b/t/07generic_token.t index a82903e..64940f5 100644 --- a/t/07generic_token.t +++ b/t/07generic_token.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 4; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -30,3 +31,5 @@ is( $parser->from_string( "Hello" ), "Hello", 'RE with flags' ); $convert = sub { lc $_[1] }; is( $parser->from_string( "Hello" ), "hello", 'Conversion function' ); + +done_testing; diff --git a/t/10token_int.t b/t/10token_int.t index 943f219..1c3847d 100644 --- a/t/10token_int.t +++ b/t/10token_int.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 8; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -30,3 +31,5 @@ ok( !eval { $parser->from_string( "hello" ) }, '"hello" fails' ); $parser = TestParser->new( accept_0o_oct => 1 ); is( $parser->from_string( "0o20" ), 16, 'Octal integer with 0o prefix' ); + +done_testing; diff --git a/t/11token_float.t b/t/11token_float.t index 3746f6b..fab57e5 100644 --- a/t/11token_float.t +++ b/t/11token_float.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 13; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -43,3 +44,5 @@ approx( $parser->from_string( "50E-1" ), 5, 'Scientific with negative exponent approx( $parser->from_string( "60.0E-1" ), 6, 'Scientific with DP with negative exponent' ); approx( $parser->from_string( "1e0" ), 1, 'Scientific with lowercase e' ); + +done_testing; diff --git a/t/12token_number.t b/t/12token_number.t index 0b150b1..4b9ca4f 100644 --- a/t/12token_number.t +++ b/t/12token_number.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 7; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -35,3 +36,5 @@ approx( $parser->from_string( ".34" ), 0.34, 'Leading DP' ); approx( $parser->from_string( "8.9" ), 8.9, 'Infix DP' ); ok( !eval { $parser->from_string( "hello" ) }, '"hello" fails' ); + +done_testing; diff --git a/t/13token_string.t b/t/13token_string.t index 64f1a30..0386cc9 100644 --- a/t/13token_string.t +++ b/t/13token_string.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 18; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -61,3 +62,5 @@ $parser = StringPairParser->new; is_deeply( $parser->from_string( q["foo" "bar"] ), [ "foo", "bar" ], 'String-matching pattern is non-greedy' ); + +done_testing; diff --git a/t/14token_ident.t b/t/14token_ident.t index 50d42f1..6ac1202 100644 --- a/t/14token_ident.t +++ b/t/14token_ident.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 6; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -36,3 +37,5 @@ $parser = TestParser->new( ); is( $parser->from_string( "some-ident" ), "some-ident", '"some-ident" passes with new token pattern' ); + +done_testing; diff --git a/t/15token_kw.t b/t/15token_kw.t index d534245..f7a1d09 100644 --- a/t/15token_kw.t +++ b/t/15token_kw.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 3; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -26,3 +27,5 @@ is( $@, qq[splot\n] . qq[^\n], 'Exception from "splot" failure' ); + +done_testing; diff --git a/t/20maybe.t b/t/20maybe.t index e58235f..3af9baf 100644 --- a/t/20maybe.t +++ b/t/20maybe.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 4; +use Test::More; my $die; @@ -30,3 +31,5 @@ is( $parser->from_string( "123" ), 123, '"123"' ); $die = "Now have to fail\n"; ok( !eval { $parser->from_string( "456" ) }, '"456" with $die fails' ); is( $@, "Now have to fail\n", 'Exception from failure' ); + +done_testing; diff --git a/t/21scope_of.t b/t/21scope_of.t index 1ebf552..34ea2da 100644 --- a/t/21scope_of.t +++ b/t/21scope_of.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 6; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -50,3 +51,5 @@ is( $parser->from_string( "(45)" ), 45, '"(45)"' ); is( $parser->from_string( "[45]" ), 45, '"[45]"' ); ok( !eval { $parser->from_string( "(45]" ) }, '"(45]" fails' ); + +done_testing; diff --git a/t/22list_of.t b/t/22list_of.t index d3a48be..70d3b74 100644 --- a/t/22list_of.t +++ b/t/22list_of.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 3; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -23,3 +24,5 @@ my $parser = TestParser->new; is_deeply( $parser->from_string( "123" ), [ 123 ], '"123"' ); is_deeply( $parser->from_string( "4,5,6" ), [ 4, 5, 6 ], '"4,5,6"' ); is_deeply( $parser->from_string( "7, 8" ), [ 7, 8 ], '"7, 8"' ); + +done_testing; diff --git a/t/23sequence_of.t b/t/23sequence_of.t index deaf7a3..ac4934c 100644 --- a/t/23sequence_of.t +++ b/t/23sequence_of.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 6; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -52,3 +53,5 @@ is_deeply( $parser->from_string( "10 20" ), is_deeply( $parser->from_string( "'ab' 'cd'" ), [ [], [ 'ab', 'cd' ] ], q("'ab' 'cd'") ); + +done_testing; diff --git a/t/24any_of.t b/t/24any_of.t index aec0559..156c9bf 100644 --- a/t/24any_of.t +++ b/t/24any_of.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 6; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -31,3 +32,5 @@ ok( !eval { $parser->from_string( "@" ) }, '"@" fails' ); is( $@, "Here I fail\n", 'Exception from "@" failure' ); ok( !eval { $parser->from_string( "+" ) }, '"+" fails' ); + +done_testing; diff --git a/t/30commit.t b/t/30commit.t index c7207c0..aad368e 100644 --- a/t/30commit.t +++ b/t/30commit.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 7; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -67,3 +68,5 @@ is( $@, qq[1 'one' 2\n]. qq[ ^\n], 'Exception from 1 \'one\' 2 failure' ); + +done_testing; diff --git a/t/31scope_level.t b/t/31scope_level.t index 50e581f..d8485a0 100644 --- a/t/31scope_level.t +++ b/t/31scope_level.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 3; +use Test::More; package TestParser; use base qw( Parser::MGC ); @@ -28,3 +29,5 @@ my $parser = TestParser->new; is_deeply( $parser->from_string( "a" ), [ "a/0" ], 'a' ); is_deeply( $parser->from_string( "(b)" ), [ [ "b/1" ] ], '(b)' ); is_deeply( $parser->from_string( "c (d) e" ), [ "c/0", [ "d/1" ], "e/0" ], 'c (d) e' ); + +done_testing; diff --git a/t/32exception.t b/t/32exception.t index 86455b0..edbcb82 100644 --- a/t/32exception.t +++ b/t/32exception.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 9; +use Test::More; use File::Temp qw( tempfile ); package TestParser; @@ -53,5 +54,7 @@ is( $@, qq[ ^\n], 'Exception from trailing input on named file' ); +done_testing; + __DATA__ 123. diff --git a/t/90ex_dict.t b/t/90ex_dict.t index efdd78d..eef0a21 100644 --- a/t/90ex_dict.t +++ b/t/90ex_dict.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 4; +use Test::More; require "examples/parse-dict.pl"; @@ -30,3 +31,5 @@ test q[{one: 1, two: 2}], test q[{numbers: {three: 3, four: 4}}], { numbers => { three => 3, four => 4 } }, "Nested dict"; + +done_testing; diff --git a/t/90ex_expr.t b/t/90ex_expr.t index c3df649..d153c9b 100644 --- a/t/90ex_expr.t +++ b/t/90ex_expr.t @@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Test::More; diff --git a/t/90ex_pod.t b/t/90ex_pod.t index 1dbb98f..0e469ef 100644 --- a/t/90ex_pod.t +++ b/t/90ex_pod.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 5; +use Test::More; require "examples/parse-pod.pl"; @@ -34,3 +35,5 @@ test "Nested B<I<tags>>", test "Double C<< Class->method >> tags", [ "Double ", { C => [ " Class->method " ] }, " tags" ], "Double tags"; + +done_testing; diff --git a/t/90ex_synopsis.t b/t/90ex_synopsis.t index 097c4ca..813cbd9 100644 --- a/t/90ex_synopsis.t +++ b/t/90ex_synopsis.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 4; +use Test::More; require "examples/synopsis.pl"; @@ -19,3 +20,5 @@ test "123", 123; test "'hello'", 'hello'; test "(123 456)", [ 123, 456 ]; test "(+ 1 (* 2 3))", [ \'+', 1, [ \'*', 2, 3 ] ]; + +done_testing; diff --git a/t/90ex_xml.t b/t/90ex_xml.t index 30a852c..6dc0a28 100644 --- a/t/90ex_xml.t +++ b/t/90ex_xml.t @@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Test::More tests => 5; @@ -37,3 +38,5 @@ test q[<xml><first>Hello</first> <second>world</second></xml>], test q[<xml><node a1="v1" a2="v2" /></xml>], [ elem(node => { a1 => "v1", a2 => "v2" }) ], "Node with attrs"; + +done_testing; diff --git a/t/98backcompat.t b/t/98backcompat.t index a4d9f1c..0154b0a 100644 --- a/t/98backcompat.t +++ b/t/98backcompat.t @@ -1,8 +1,9 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; -use Test::More tests => 2; +use Test::More; package OneOfParser; use base qw( Parser::MGC ); @@ -23,3 +24,5 @@ my $parser = OneOfParser->new; is_deeply( $parser->from_string( "123" ), [ int => 123 ], 'one_of integer' ); is_deeply( $parser->from_string( q["hi"] ), [ str => "hi" ], 'one_of string' ); + +done_testing; diff --git a/t/99pod.t b/t/99pod.t index 339b17d..eb319fb 100644 --- a/t/99pod.t +++ b/t/99pod.t @@ -1,4 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl + +use strict; +use warnings; use Test::More; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparser-mgc-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits