r62119 - in /branches/upstream/libtest-regression-perl: ./ current/ current/lib/ current/lib/Test/ current/t/ current/t/lib/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Sat Aug 28 14:08:24 UTC 2010


Author: periapt-guest
Date: Sat Aug 28 14:08:11 2010
New Revision: 62119

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=62119
Log:
[svn-inject] Installing original source of libtest-regression-perl (0.05)

Added:
    branches/upstream/libtest-regression-perl/
    branches/upstream/libtest-regression-perl/current/
    branches/upstream/libtest-regression-perl/current/Build.PL
    branches/upstream/libtest-regression-perl/current/Changes
    branches/upstream/libtest-regression-perl/current/MANIFEST
    branches/upstream/libtest-regression-perl/current/META.yml
    branches/upstream/libtest-regression-perl/current/Makefile.PL
    branches/upstream/libtest-regression-perl/current/README
    branches/upstream/libtest-regression-perl/current/lib/
    branches/upstream/libtest-regression-perl/current/lib/Test/
    branches/upstream/libtest-regression-perl/current/lib/Test/Regression.pm
    branches/upstream/libtest-regression-perl/current/t/
    branches/upstream/libtest-regression-perl/current/t/00-load.t
    branches/upstream/libtest-regression-perl/current/t/boilerplate.t
    branches/upstream/libtest-regression-perl/current/t/changes.t
    branches/upstream/libtest-regression-perl/current/t/lib/
    branches/upstream/libtest-regression-perl/current/t/lib/OutputDir.pm
    branches/upstream/libtest-regression-perl/current/t/manifest.t
    branches/upstream/libtest-regression-perl/current/t/open.t
    branches/upstream/libtest-regression-perl/current/t/perlcritic.t
    branches/upstream/libtest-regression-perl/current/t/perlcriticrc
    branches/upstream/libtest-regression-perl/current/t/pod-coverage.t
    branches/upstream/libtest-regression-perl/current/t/pod.t
    branches/upstream/libtest-regression-perl/current/t/podspell.t
    branches/upstream/libtest-regression-perl/current/t/prereq.t
    branches/upstream/libtest-regression-perl/current/t/print.t
    branches/upstream/libtest-regression-perl/current/t/regression.t

Added: branches/upstream/libtest-regression-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/Build.PL?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/Build.PL (added)
+++ branches/upstream/libtest-regression-perl/current/Build.PL Sat Aug 28 14:08:11 2010
@@ -1,0 +1,27 @@
+use Module::Build;
+
+Module::Build->new(
+    module_name => 'Test::Regression',
+    license => 'perl',
+    requires => {
+        'Test::More' => 0,
+        'Test::Differences' => 0,
+        'Text::Diff' => 0,
+        'Algorithm::Diff' => 0,
+	'FileHandle' => 0
+    },
+    build_requires => {
+        'Test::MockObject' => 0,
+	'DirHandle' => 0,
+	'File::Spec' => 0
+    },
+    meta_merge => {
+        resources=> {
+            repository => 'http://github.com/periapt/test-regression/tree',
+        },
+        keywords => ['Test','Regression'],
+    },
+    create_makefile_pl => 'traditional',
+    dist_author => 'Nicholas Bamber <nicholas at periapt.co.uk>',
+)->create_build_script;
+

Added: branches/upstream/libtest-regression-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/Changes?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/Changes (added)
+++ branches/upstream/libtest-regression-perl/current/Changes Sat Aug 28 14:08:11 2010
@@ -1,0 +1,18 @@
+Revision history for Test-Regression
+
+0.01    12-09-2009
+        First version
+
+0.02	13-09-2009
+	Headline documentation error. Fixed t/changes.t and t/manifest.t
+
+0.03 	20-09-2009
+	Added more dependencies and license
+
+0.04 	28-09-2009
+	Various documentation changes
+
+0.05 	21-01-2010
+	Tested for zero-length output in generating file (rt53893).
+	Added tests for 'open' and 'print' functions failing.
+	Migrated to OS independent access to file system in test scripts

Added: branches/upstream/libtest-regression-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/MANIFEST?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/MANIFEST (added)
+++ branches/upstream/libtest-regression-perl/current/MANIFEST Sat Aug 28 14:08:11 2010
@@ -1,0 +1,21 @@
+Changes
+lib/Test/Regression.pm
+Makefile.PL
+Build.PL
+MANIFEST
+README
+t/00-load.t
+t/boilerplate.t
+t/changes.t
+t/manifest.t
+t/print.t
+t/open.t
+t/perlcritic.t
+t/perlcriticrc
+t/pod-coverage.t
+t/pod.t
+t/podspell.t
+t/regression.t
+t/prereq.t
+META.yml
+t/lib/OutputDir.pm

Added: branches/upstream/libtest-regression-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/META.yml?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/META.yml (added)
+++ branches/upstream/libtest-regression-perl/current/META.yml Sat Aug 28 14:08:11 2010
@@ -1,0 +1,33 @@
+---
+name: Test-Regression
+version: 0.05
+author:
+  - 'Nicholas Bamber <nicholas at periapt.co.uk>'
+abstract: Test library that can be run in two modes; one to generate outputs and a second to compare against them
+license: perl
+resources:
+  license: http://dev.perl.org/licenses/
+  repository: http://github.com/periapt/test-regression/tree
+build_requires:
+  DirHandle: 0
+  File::Spec: 0
+  Test::MockObject: 0
+requires:
+  Algorithm::Diff: 0
+  FileHandle: 0
+  Test::Differences: 0
+  Test::More: 0
+  Text::Diff: 0
+configure_requires:
+  Module::Build: 0.35
+provides:
+  Test::Regression:
+    file: lib/Test/Regression.pm
+    version: 0.05
+generated_by: Module::Build version 0.35
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+keywords:
+  - Test
+  - Regression

Added: branches/upstream/libtest-regression-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/Makefile.PL?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/Makefile.PL (added)
+++ branches/upstream/libtest-regression-perl/current/Makefile.PL Sat Aug 28 14:08:11 2010
@@ -1,0 +1,21 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.35
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+          'PL_FILES' => {},
+          'INSTALLDIRS' => 'site',
+          'NAME' => 'Test::Regression',
+          'EXE_FILES' => [],
+          'VERSION_FROM' => 'lib/Test/Regression.pm',
+          'PREREQ_PM' => {
+                           'Test::MockObject' => 0,
+                           'File::Spec' => 0,
+                           'FileHandle' => 0,
+                           'Text::Diff' => 0,
+                           'Test::More' => 0,
+                           'Test::Differences' => 0,
+                           'DirHandle' => 0,
+                           'Algorithm::Diff' => 0
+                         }
+        )
+;

Added: branches/upstream/libtest-regression-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/README?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/README (added)
+++ branches/upstream/libtest-regression-perl/current/README Sat Aug 28 14:08:11 2010
@@ -1,0 +1,45 @@
+Test-Regression
+
+Test library that can be run in two modes: once to generate outputs and secondly to compare against them
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+	perl Makefile.PL
+	make
+	make test
+	make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
+perldoc command.
+
+    perldoc Test::Regression
+
+You can also look for information at:
+
+    RT, CPAN's request tracker
+        http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Regression
+
+    AnnoCPAN, Annotated CPAN documentation
+        http://annocpan.org/dist/Test-Regression
+
+    CPAN Ratings
+        http://cpanratings.perl.org/d/Test-Regression
+
+    Search CPAN
+        http://search.cpan.org/dist/Test-Regression/
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2009 Nicholas Bamber
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of either: the GNU General Public License as published
+by the Free Software Foundation; or the Artistic License.
+
+See http://dev.perl.org/licenses/ for more information.
+

Added: branches/upstream/libtest-regression-perl/current/lib/Test/Regression.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/lib/Test/Regression.pm?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/lib/Test/Regression.pm (added)
+++ branches/upstream/libtest-regression-perl/current/lib/Test/Regression.pm Sat Aug 28 14:08:11 2010
@@ -1,0 +1,164 @@
+package Test::Regression;
+
+use warnings;
+use strict;
+use FileHandle;
+
+=head1 NAME
+
+Test::Regression - Test library that can be run in two modes; one to generate outputs and a second to compare against them
+
+=head1 VERSION
+
+Version 0.05
+
+=cut
+
+our $VERSION = '0.05';
+
+=head1 SYNOPSIS
+
+  use Test::Regression;
+  ok_regression(sub {return "hello world"}, "t/out/hello_world.txt");
+
+=head1 DESCRIPTION
+
+Using the various Test:: modules you can compare the output of a function against what you expect.
+However if the output is complex and changes from version to version, maintenance of the expected
+output could be costly. This module allows one to use the test code to generate the expected output,
+so that if the differences with model output are expected, one can easily refresh the model output.
+
+=head1 EXPORT
+
+ok_regression
+
+=cut
+
+use Test::Builder::Module;
+use Test::Differences;
+use base qw(Test::Builder::Module);
+our @EXPORT = qw(ok_regression);
+my $CLASS = __PACKAGE__;
+
+=head1 FUNCTIONS
+
+=head2 ok_regression
+
+This function requires two arguments: a CODE ref and a file path. 
+The CODE ref is expected to return a SCALAR string which 
+can be compared against previous runs.
+If the TEST_REGRESSION_GEN is set to a true value, then the CODE ref is run and the 
+output written to the file. Otherwise the output of the
+file is compared against the contents of the file.
+There is a third optional argument which is the test name.
+
+=cut
+
+sub ok_regression {
+	my $code_ref = shift;
+	my $file = shift;
+	my $test_name = shift;
+	my $output = eval {&$code_ref();};
+	my $tb = $CLASS->builder;
+	if ($@) {
+		$tb->diag($@);
+		return $tb->ok(0, $test_name);
+	}
+
+	# generate the output files if required
+	if ($ENV{TEST_REGRESSION_GEN}) {
+		my $fh = FileHandle->new;
+		$fh->open(">$file") ||  return $tb->ok(0, "$test_name: cannot open $file");
+		if (length $output) {
+			$fh->print($output) || return $tb->ok(0, "actual write failed: $file");
+		}
+		return $tb->ok(1, $test_name);
+	}
+
+	# compare the files
+	return $tb->ok(0, "$test_name: cannot read $file") unless -r $file;
+	my $fh = FileHandle->new;
+	$fh->open("<$file") ||  return $tb->ok(0, "$test_name: cannot open $file");
+	my $content = join '', (<$fh>);
+	eq_or_diff($output, $content, $test_name);
+	return $output eq $file;
+}
+
+=head1 ENVIRONMENT VARIABLES
+
+=head2 TEST_REGRESSION_GEN
+
+If the TEST_REGRESSION_GEN environment file is unset or false in a perl sense, then the named output files must exist and be readable and the
+test will run normally comparing the outputs of the CODE refs against the contents of those files. If the environment variable is true in 
+a perl sense, then model output files will be overwritten with the output of the CODE ref.
+
+=head1 AUTHOR
+
+Nicholas Bamber, C<< <nicholas at periapt.co.uk> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to C<bug-test-regression at rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Regression>.  I will be notified, and then you'll
+automatically be notified of progress on your bug as I make changes.
+
+=head2 testing of STDERR
+
+The testing of stderr from this module is not as thorough as I would like. L<Test::Builder::Tester> allows turning
+off of stderr checking but not matching by regular expression. Handcrafted efforts currently fall foul of L<Test::Harness>.
+Still it is I believe adequately tested in terms of coverage.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc Test::Regression
+
+
+You can also look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Regression>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Test-Regression>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Test-Regression>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Test-Regression/>
+
+=back
+
+
+=head1 ACKNOWLEDGEMENTS
+
+=over
+
+=item Some documentation improvements have been suggested by toolic (http://perlmonks.org/?node_id=622051).
+
+=item Thanks to Filip GraliE<0x144>ski for pointing out I need to test against output of zero length and providing a patch.
+
+=back 
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2009 Nicholas Bamber.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of either: the GNU General Public License as published
+by the Free Software Foundation; or the Artistic License.
+
+See http://dev.perl.org/licenses/ for more information.
+
+
+=cut
+
+1; # End of Test::Regression

Added: branches/upstream/libtest-regression-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/00-load.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/00-load.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/00-load.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+    use_ok( 'Test::Regression' );
+}
+
+diag( "Testing Test::Regression $Test::Regression::VERSION, Perl $], $^X" );

Added: branches/upstream/libtest-regression-perl/current/t/boilerplate.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/boilerplate.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/boilerplate.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/boilerplate.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,54 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+    my ($filename, %regex) = @_;
+    open( my $fh, '<', $filename )
+        or die "couldn't open $filename for reading: $!";
+
+    my %violated;
+
+    while (my $line = <$fh>) {
+        while (my ($desc, $regex) = each %regex) {
+            if ($line =~ $regex) {
+                push @{$violated{$desc}||=[]}, $.;
+            }
+        }
+    }
+
+    if (%violated) {
+        fail("$filename contains boilerplate text");
+        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+    } else {
+        pass("$filename contains no boilerplate text");
+    }
+}
+
+sub module_boilerplate_ok {
+    my ($module) = @_;
+    not_in_file_ok($module =>
+        'the great new $MODULENAME'   => qr/ - The great new /,
+        'boilerplate description'     => qr/Quick summary of what the module/,
+        'stub function definition'    => qr/function[12]/,
+    );
+}
+
+{
+
+  not_in_file_ok(README =>
+    "The README is used..."       => qr/The README is used/,
+    "'version information here'"  => qr/to provide version information/,
+  );
+
+  not_in_file_ok(Changes =>
+    "placeholder date/time"       => qr(Date/time)
+  );
+
+  module_boilerplate_ok('lib/Test/Regression.pm');
+
+
+}
+

Added: branches/upstream/libtest-regression-perl/current/t/changes.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/changes.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/changes.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/changes.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+
+if ( not $ENV{TEST_AUTHOR} ) {
+    my $msg = 'Author test.  Set $ENV{TEST_AUTHOR} to a true value to run.';
+    plan( skip_all => $msg );
+}
+
+eval { require Test::CheckChanges; };
+
+if ( $@ ) {
+   my $msg = 'Test::CheckChanges required to check Changes';
+   plan( skip_all => $msg );
+}
+Test::CheckChanges::ok_changes();
+
+

Added: branches/upstream/libtest-regression-perl/current/t/lib/OutputDir.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/lib/OutputDir.pm?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/lib/OutputDir.pm (added)
+++ branches/upstream/libtest-regression-perl/current/t/lib/OutputDir.pm Sat Aug 28 14:08:11 2010
@@ -1,0 +1,21 @@
+package OutputDir;
+use strict;
+use warnings;
+use Carp;
+use File::Spec;
+use DirHandle;
+use FileHandle;
+
+sub BEGIN {
+	my $dirname = File::Spec->catfile("t", "output");
+	mkdir $dirname || croak "error: $!";
+
+	my $dir = DirHandle->new($dirname);
+	if (defined $dir) {
+		while (defined($_ = $dir->read)) {
+			unlink File::Spec->catfile($dirname, $_);
+		}
+	}
+}
+
+1

Added: branches/upstream/libtest-regression-perl/current/t/manifest.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/manifest.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/manifest.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/manifest.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+
+if ( not $ENV{TEST_AUTHOR} ) {
+    my $msg = 'Author test.  Set $ENV{TEST_AUTHOR} to a true value to run.';
+    plan( skip_all => $msg );
+}
+
+eval { require Test::CheckManifest; };
+
+if ( $@ ) {
+   my $msg = 'Test::CheckManifest required to check manifest';
+   plan( skip_all => $msg );
+}
+
+Test::CheckManifest::ok_manifest({filter=>[qr/\/\.git/,qr/\.bak$/,qr/\.old$/,qr/t\/dbfile$/,qr/\.tar\.gz$/,qr/\/t\/output\/\w{2}$/]});
+

Added: branches/upstream/libtest-regression-perl/current/t/open.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/open.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/open.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/open.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,70 @@
+#!perl 
+
+use strict;
+use warnings;
+our $mock;
+
+use Test::Builder::Tester tests => 3;
+use Test::More;
+BEGIN {
+  eval "use Test::MockObject::Extends";
+  unless( $@ ) {
+    use FileHandle;
+    $mock= Test::MockObject::Extends->new(FileHandle->new);
+    $mock->fake_new( 'FileHandle' );
+    $mock->set_false( 'open' );
+  }
+
+  use_ok( 'FileHandle' );
+  use_ok( 'Test::Regression' );
+}
+
+use Test::Regression;
+srand(42);
+use lib qw(t/lib);
+use OutputDir;
+
+sub faithful_function {
+    my $r = "";
+    for(my $i = 0; $i < 10; $i++) {
+	$r .= "$i\n";
+    }
+    return $r;
+}
+
+sub unfaithful_function {
+    my $r = "";
+    for(my $i = 0; $i < 10; $i++) {
+	$r .= rand()."\n";
+    }
+    return $r;
+}
+
+sub empty_string_function {
+    return '';
+}
+
+
+test_out("not ok 1 - f1 gen: cannot open t/output/f1");
+test_out("not ok 2 - f1 check: cannot read t/output/f1");
+test_out("not ok 3 - f2 gen: cannot open t/output/f2");
+test_out("not ok 4 - f2 check: cannot read t/output/f2");
+test_out("not ok 5 - f4 gen: cannot open t/output/f4");
+test_out("not ok 6 - f4 check: cannot read t/output/f4");
+test_diag("  Failed test 'f2 check'");
+
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&faithful_function, "t/output/f1", "f1 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&faithful_function, "t/output/f1", "f1 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&unfaithful_function, "t/output/f2", "f2 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&unfaithful_function, "t/output/f2", "f2 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&empty_string_function, "t/output/f4", "f4 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&empty_string_function, "t/output/f4", "f4 check");
+
+test_test(name=>"blah", skip_err=>1);
+

Added: branches/upstream/libtest-regression-perl/current/t/perlcritic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/perlcritic.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/perlcritic.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/perlcritic.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,24 @@
+use strict;
+use warnings;
+use File::Spec;
+use Test::More;
+use English qw(-no_match_vars);
+
+if ( not $ENV{TEST_AUTHOR} ) {
+    my $msg = 'Author test.  Set $ENV{TEST_AUTHOR} to a true value to run.';
+    plan( skip_all => $msg );
+}
+
+eval { require Test::Perl::Critic; };
+
+if ( $EVAL_ERROR ) {
+   my $msg = 'Test::Perl::Critic required to criticise code';
+   plan( skip_all => $msg );
+}
+
+my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
+#use Test::Perl::Critic;
+
+Test::Perl::Critic->import( -profile => $rcfile );
+all_critic_ok();
+

Added: branches/upstream/libtest-regression-perl/current/t/perlcriticrc
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/perlcriticrc?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/perlcriticrc (added)
+++ branches/upstream/libtest-regression-perl/current/t/perlcriticrc Sat Aug 28 14:08:11 2010
@@ -1,0 +1,2 @@
+severity = 1
+exclude = Subroutines::ProhibitExplicitReturnUndef Subroutines::RequireArgUnpacking ClassHierarchies::ProhibitAutoloading RegularExpressions Miscellanea::RequireRcsKeywords Documentation::RequirePodAtEnd ControlStructures::ProhibitUnlessBlocks ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions ControlStructures::ProhibitPostfixControls Documentation::RequirePodSections References::ProhibitDoubleSigils Variables::ProhibitPunctuationVars ValuesAndExpressions::ProhibitInterpolationOfLiterals Subroutines::ProhibitManyArgs ValuesAndExpressions::ProhibitNoisyQuotes ValuesAndExpressions::ProhibitEmptyQuotes

Added: branches/upstream/libtest-regression-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/pod-coverage.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/pod-coverage.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+    if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+    if $@;
+
+all_pod_coverage_ok();

Added: branches/upstream/libtest-regression-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/pod.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/pod.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/pod.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();

Added: branches/upstream/libtest-regression-perl/current/t/podspell.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/podspell.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/podspell.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/podspell.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,20 @@
+use strict;
+use warnings;
+use English qw(-no_match_vars);
+use Test::More;
+
+if ( not $ENV{TEST_AUTHOR} ) {
+    my $msg = 'Author test.  Set $ENV{TEST_AUTHOR} to a true value to run.';
+    plan( skip_all => $msg );
+}
+
+eval { require Test::Spelling; };
+
+if ( $EVAL_ERROR ) {
+   my $msg = 'Test::Spelling required to criticise code';
+   plan( skip_all => $msg );
+}
+
+Test::Spelling::add_stopwords(qw(CPAN Bamber AnnoCPAN RT internalId lang param HTML URLs href sitemap SQL bladger javascript loopName URL globalvars pageId pageid sitemaps XML changefreq en lastmod notfound pagelookup runmode runmodes url utf namespace upto stderr yml toolic Filip Grali));
+Test::Spelling::all_pod_files_spelling_ok();
+

Added: branches/upstream/libtest-regression-perl/current/t/prereq.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/prereq.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/prereq.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/prereq.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,19 @@
+use strict;
+use warnings;
+use Test::More;
+
+if ( not $ENV{TEST_PREREQ} ) {
+    my $msg = 'Author test.  Set $ENV{TEST_PREREQ} to a true value to run.';
+    plan( skip_all => $msg );
+}
+
+eval { require Test::Prereq::Build; };
+
+if ( $@) {
+   my $msg = 'Test::Prereq required to criticise code';
+   plan( skip_all => $msg );
+}
+
+Test::Prereq::Build::prereq_ok(undef, 'prereq', ['Test::CheckChanges', 'Test::CheckManifest', 'Test::Spelling', 'Test::Prereq', 'Test::Prereq::Build', 'Test::Perl::Critic','OutputDir']);
+
+

Added: branches/upstream/libtest-regression-perl/current/t/print.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/print.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/print.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/print.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,70 @@
+#!perl 
+
+use strict;
+use warnings;
+our $mock;
+
+use Test::Builder::Tester tests => 2;
+use Test::More;
+BEGIN {
+  use FileHandle;
+  eval "use Test::MockObject::Extends";
+  unless( $@ ) {
+    $mock = FileHandle->new;
+    $mock= Test::MockObject::Extends->new($mock);
+    $mock->set_false( 'print' );
+    $mock->fake_new('FileHandle');
+  }
+
+  use_ok( 'Test::Regression' );
+}
+
+use Test::Regression;
+srand(42);
+use lib qw(t/lib);
+use OutputDir;
+
+sub faithful_function {
+    my $r = "";
+    for(my $i = 0; $i < 10; $i++) {
+	$r .= "$i\n";
+    }
+    return $r;
+}
+
+sub unfaithful_function {
+    my $r = "";
+    for(my $i = 0; $i < 10; $i++) {
+	$r .= rand()."\n";
+    }
+    return $r;
+}
+
+sub empty_string_function {
+    return '';
+}
+
+
+test_out("not ok 1 - actual write failed: t/output/f1");
+test_out("not ok 2 - f1 check");
+test_out("not ok 3 - actual write failed: t/output/f2");
+test_out("not ok 4 - f2 check");
+test_out("ok 5 - f4 gen");
+test_out("ok 6 - f4 check");
+test_diag("  Failed test 'f2 check'");
+
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&faithful_function, "t/output/f1", "f1 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&faithful_function, "t/output/f1", "f1 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&unfaithful_function, "t/output/f2", "f2 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&unfaithful_function, "t/output/f2", "f2 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&empty_string_function, "t/output/f4", "f4 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&empty_string_function, "t/output/f4", "f4 check");
+
+test_test(name=>"blah", skip_err=>1);
+

Added: branches/upstream/libtest-regression-perl/current/t/regression.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-regression-perl/current/t/regression.t?rev=62119&op=file
==============================================================================
--- branches/upstream/libtest-regression-perl/current/t/regression.t (added)
+++ branches/upstream/libtest-regression-perl/current/t/regression.t Sat Aug 28 14:08:11 2010
@@ -1,0 +1,65 @@
+#!perl 
+
+use strict;
+use warnings;
+use Test::Builder::Tester tests => 1;
+use Test::More;
+use Test::Regression;
+use lib qw(t/lib);
+srand(42);
+use OutputDir;
+
+sub faithful_function {
+    my $r = "";
+    for(my $i = 0; $i < 10; $i++) {
+	$r .= "$i\n";
+    }
+    return $r;
+}
+
+sub unfaithful_function {
+    my $r = "";
+    for(my $i = 0; $i < 10; $i++) {
+	$r .= rand()."\n";
+    }
+    return $r;
+}
+
+sub fatal_function {
+    die "How am I doing?";
+}
+
+sub empty_string_function {
+    return '';
+}
+
+
+test_out("ok 1 - f1 gen");
+test_out("ok 2 - f1 check");
+test_out("ok 3 - f2 gen");
+test_out("not ok 4 - f2 check");
+test_out("not ok 5 - f3 gen");
+test_out("not ok 6 - f3 check");
+test_out("ok 7 - f4 gen");
+test_out("ok 8 - f4 check");
+test_diag("  Failed test 'f2 check'");
+
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&faithful_function, "t/output/f1", "f1 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&faithful_function, "t/output/f1", "f1 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&unfaithful_function, "t/output/f2", "f2 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&unfaithful_function, "t/output/f2", "f2 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&fatal_function, "t/output/f3", "f3 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&fatal_function, "t/output/f3", "f3 check");
+$ENV{TEST_REGRESSION_GEN} = 1;
+ok_regression(\&empty_string_function, "t/output/f4", "f4 gen");
+delete $ENV{TEST_REGRESSION_GEN};
+ok_regression(\&empty_string_function, "t/output/f4", "f4 check");
+
+test_test(name=>"blah", skip_err=>1);
+




More information about the Pkg-perl-cvs-commits mailing list