Permalink
Browse files

reworked test suite

  • Loading branch information...
1 parent 06f678b commit 4c80eff56cdf1acd7847310f598e2b1ba55fb2df @barbie committed Jan 27, 2013
Showing with 78 additions and 19 deletions.
  1. +1 −0 Changes
  2. +1 −0 MANIFEST
  3. +0 −1 t/01base.t
  4. +3 −2 t/10json.t
  5. +3 −3 t/11yaml.t
  6. +3 −1 t/90podtest.t
  7. +3 −0 t/91podcover.t
  8. +12 −8 t/94metatest.t
  9. +24 −4 t/95changedate.t
  10. +28 −0 t/96metatest.t
View
@@ -6,6 +6,7 @@ Revision history for the CPAN-Testers-WWW-Reports-Parser distribution
- License updated to Artistic License v2.0.
- added LICENSE file.
- added META.json.
+ - reworked test suite.
0.03 2010-04-12
- added support for guid field.
View
@@ -16,5 +16,6 @@ t/90podtest.t
t/91podcover.t
t/94metatest.t
t/95changedate.t
+t/96metatest.t
t/samples/App-Maisha.json
t/samples/App-Maisha.yaml
View
@@ -19,4 +19,3 @@ BEGIN {
use_ok( 'CPAN::Testers::WWW::Reports::Parser::YAML' );
}
}
-
View
@@ -1,8 +1,9 @@
#!/usr/bin/perl -w
use strict;
-use Test::More;
+
use CPAN::Testers::WWW::Reports::Parser;
-use Data::Dumper;
+#use Data::Dumper;
+use Test::More;
eval "use JSON::XS";
plan skip_all => "JSON::XS required for testing JSON parser" if $@;
View
@@ -1,8 +1,9 @@
#!/usr/bin/perl -w
use strict;
-use Test::More;
+
use CPAN::Testers::WWW::Reports::Parser;
-use Data::Dumper;
+#use Data::Dumper;
+use Test::More;
eval "use YAML::XS";
plan skip_all => "YAML::XS required for testing YAML parser" if $@;
@@ -113,4 +114,3 @@ is($reports,$count,'.. report count correct');
is($obj->$_(),$data->{$_},".. field '$_' matches direct and indirect access");
}
}
-
View
@@ -1,3 +1,6 @@
+#!/usr/bin/perl -w
+use strict;
+
use Test::More;
# Skip if doing a regular install
@@ -7,4 +10,3 @@ plan skip_all => "Author tests not required for installation"
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();
-
View
@@ -1,3 +1,6 @@
+#!/usr/bin/perl -w
+use strict;
+
use Test::More;
# Skip if doing a regular install
View
@@ -1,24 +1,28 @@
+#!/usr/bin/perl -w
+use strict;
+
use Test::More;
# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
unless ( $ENV{AUTOMATED_TESTING} );
-eval "use Test::CPAN::Meta 0.12";
-plan skip_all => "Test::CPAN::Meta 0.12 required for testing META.yml" if $@;
+eval "use Test::CPAN::Meta";
+plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
-plan no_plan;
+plan 'no_plan';
-my $yaml = meta_spec_ok(undef,undef,@_);
+my $meta = meta_spec_ok(undef,undef,@_);
use CPAN::Testers::WWW::Reports::Parser;
+my $version = $CPAN::Testers::WWW::Reports::Parser::VERSION;
-is($yaml->{version},$CPAN::Testers::WWW::Reports::Parser::VERSION,
+is($meta->{version},$version,
'META.yml distribution version matches');
-if($yaml->{provides}) {
- for my $mod (keys %{$yaml->{provides}}) {
- is($yaml->{provides}{$mod}{version},$CPAN::Testers::WWW::Reports::Parser::VERSION,
+if($meta->{provides}) {
+ for my $mod (keys %{$meta->{provides}}) {
+ is($meta->{provides}{$mod}{version},$version,
"META.yml entry [$mod] version matches");
}
}
View
@@ -1,20 +1,40 @@
+#!/usr/bin/perl -w
+use strict;
+
use Test::More;
use IO::File;
-use CPAN::Testers::WWW::Reports::Parser;
# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
unless ( $ENV{AUTOMATED_TESTING} );
my $fh = IO::File->new('Changes','r') or plan skip_all => "Cannot open Changes file";
-plan no_plan;
+plan 'no_plan';
+
+use CPAN::Testers::WWW::Reports::Parser;
+my $version = $CPAN::Testers::WWW::Reports::Parser::VERSION;
my $latest = 0;
while(<$fh>) {
next unless(m!^\d!);
- $latest = 1 if(m!^$CPAN::Testers::WWW::Reports::Parser::VERSION!);
- like($_, qr!\d[\d._]+\s+\d{2}/\d{2}/\d{4}!,'... version has a date');
+ $latest = 1 if(m!^$version!);
+
+ # 2012-08-26T01:02 or 2012-08-26T01:02:03 or 2012-08-26T01:02:03.04 or 2012-08-26T01:02+01:00
+
+ like($_, qr!^
+ \d[\d._]+\s+ # version
+ ( \d{4}-\d{2}-\d{2} # 2012-08-26 - YYYY-MM-DD
+ ( T\d{2}:\d{2} # T01:02 - Thh:mm
+ ( :\d{2} # :02 - :ss
+ ( \.\d+ # .2 - .ss (microseconds)
+ )?
+ )?
+ ( (Z|[-+]\d+:\d+) # +01:00 - timezone
+ )?
+ )?
+ )
+ \s*$!x,'... version has a date');
}
is($latest,1,'... latest version not listed');
View
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -w
+use strict;
+
+use Test::More;
+
+# Skip if doing a regular install
+plan skip_all => "Author tests not required for installation"
+ unless ( $ENV{AUTOMATED_TESTING} );
+
+eval "use Test::CPAN::Meta::JSON";
+plan skip_all => "Test::CPAN::Meta::JSON required for testing META.json files" if $@;
+
+plan 'no_plan';
+
+my $meta = meta_spec_ok(undef,undef,@_);
+
+use CPAN::Testers::WWW::Reports::Parser;
+my $version = $CPAN::Testers::WWW::Reports::Parser::VERSION;
+
+is($meta->{version},$version,
+ 'META.json distribution version matches');
+
+if($meta->{provides}) {
+ for my $mod (keys %{$meta->{provides}}) {
+ is($meta->{provides}{$mod}{version},$version,
+ "META.json entry [$mod] version matches");
+ }
+}

0 comments on commit 4c80eff

Please sign in to comment.