r24127 - in /branches/upstream/libtest-block-perl: ./ current/ current/lib/ current/lib/Test/ current/t/ current/t/developer/

jeremiah-guest at users.alioth.debian.org jeremiah-guest at users.alioth.debian.org
Mon Aug 11 15:41:14 UTC 2008


Author: jeremiah-guest
Date: Mon Aug 11 15:41:06 2008
New Revision: 24127

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24127
Log:
[svn-inject] Installing original source of libtest-block-perl

Added:
    branches/upstream/libtest-block-perl/
    branches/upstream/libtest-block-perl/current/
    branches/upstream/libtest-block-perl/current/Build.PL
    branches/upstream/libtest-block-perl/current/Changes
    branches/upstream/libtest-block-perl/current/MANIFEST
    branches/upstream/libtest-block-perl/current/META.yml
    branches/upstream/libtest-block-perl/current/Makefile.PL
    branches/upstream/libtest-block-perl/current/README
    branches/upstream/libtest-block-perl/current/lib/
    branches/upstream/libtest-block-perl/current/lib/Test/
    branches/upstream/libtest-block-perl/current/lib/Test/Block.pm
    branches/upstream/libtest-block-perl/current/t/
    branches/upstream/libtest-block-perl/current/t/all_in_block.t
    branches/upstream/libtest-block-perl/current/t/bad_args.t
    branches/upstream/libtest-block-perl/current/t/block.t
    branches/upstream/libtest-block-perl/current/t/class_methods.t
    branches/upstream/libtest-block-perl/current/t/developer/
    branches/upstream/libtest-block-perl/current/t/developer/documented.t   (with props)
    branches/upstream/libtest-block-perl/current/t/developer/perlcritic.t
    branches/upstream/libtest-block-perl/current/t/developer/perlcriticrc
    branches/upstream/libtest-block-perl/current/t/developer/pod.t   (with props)
    branches/upstream/libtest-block-perl/current/t/developer/spelling.t
    branches/upstream/libtest-block-perl/current/t/import.t
    branches/upstream/libtest-block-perl/current/t/variable.t

Added: branches/upstream/libtest-block-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/Build.PL?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/Build.PL (added)
+++ branches/upstream/libtest-block-perl/current/Build.PL Mon Aug 11 15:41:06 2008
@@ -1,0 +1,16 @@
+use Module::Build;
+
+my $build = Module::Build->new(
+    module_name => 'Test::Block',
+    license => 'perl',
+    requires => {
+        'perl'           => '5.6.1',
+        'Test::Builder'         => '0.17',
+        'Test::Builder::Tester' => '1.01',
+        'Test::More'            => '0.47',
+        'Test::Exception'       => '0.15',
+    },
+    create_makefile_pl => 'traditional',
+    create_readme => 1,
+);
+$build->create_build_script;

Added: branches/upstream/libtest-block-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/Changes?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/Changes (added)
+++ branches/upstream/libtest-block-perl/current/Changes Mon Aug 11 15:41:06 2008
@@ -1,0 +1,66 @@
+Revision history for Perl extension Test::Block.
+
+0.11
+    -   Removed spelling.t, pod.t, signature.t and documented.t from mandatory 
+        tests
+    -   Added a bunch of optional developer tests
+    -   Added reference to Test::Group (thanks to Nadim Khemir)
+    -   Named blocks are now 'quoted' if they're not the default number (thanks
+        to Nadim Khemir for pointing this out)
+
+0.10
+    -   Can now name a block with a string that maps to false if you want
+    -   Test coverage now at 100% (statement, branch & condition)
+
+0.09
+    -   Moved stuff from build_requires to requires so it works with
+        CPANPLUS
+    -   Added COMMUNITY section to POD
+    -   Removed a bogus UNIVERSAL::isa just in case somebody wants to 
+        subclass nicely
+    -   Tidied code a little
+    -   Stopped Test::Block accepting some bad plans
+    -   Added Test::Class to SEE ALSO section
+    -   Added link to tada list to the TO DO section of the POD
+
+0.08
+    -   Cosmetic changes to POD
+
+0.07
+    -   Requires Test::Builder::Tester 1.01 so tests will pass with
+        Test::Simple 0.48.
+    -   New signature file since old key about to be revoked
+
+0.06
+    -   Fixed incorrect comment that 0.05 wasn't released on CPAN (doh!)
+    -   Fixed incorrect README (double doh!)
+    -   Switched to Module::Build so I won't make that darn README 
+        mistake again
+    -   Added signature tests
+
+0.05
+    -   removed blocks declaration
+    -   pod.t now uses Test::Pod
+    -   documented.t now uses Test::Pod::Coverage
+    -   cleaned up code a bit
+    -   now dies if you don't specify the number of tests
+    -   block names default to the block number
+    -   blocks now named NAME => NUM_TESTS
+
+0.04 (not released on CPAN)
+    -   Added named blocks (suggested by Fergal Daly)
+    -   Added all_in_block, builder and block_count class methods
+    -   Added $Plan (suggested by Michael G Schwern)
+    -   Renamed C<expecting> to C<plan> for consistancy
+    -   Rewrote POD
+
+0.03 (not released on CPAN)
+    -   Rewrote as a sane object to avoid evil tie/Hook::LexWrap code :-)
+
+0.02 (not released on CPAN)
+    -   Rewrote so that it would cope with nested blocks
+
+0.01  Mon May  5 21:28:59 2003
+    - original version; created by h2xs 1.22 with options
+        --compat-version=5.6.1 --use-new-tests --skip-exporter -APX -n Test::Block
+

Added: branches/upstream/libtest-block-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/MANIFEST?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/MANIFEST (added)
+++ branches/upstream/libtest-block-perl/current/MANIFEST Mon Aug 11 15:41:06 2008
@@ -1,0 +1,18 @@
+Build.PL
+Changes
+lib/Test/Block.pm
+MANIFEST			This list of files
+t/all_in_block.t
+t/bad_args.t
+t/block.t
+t/class_methods.t
+t/developer/documented.t
+t/developer/perlcritic.t
+t/developer/perlcriticrc
+t/developer/pod.t
+t/developer/spelling.t
+t/import.t
+t/variable.t
+Makefile.PL
+README
+META.yml

Added: branches/upstream/libtest-block-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/META.yml?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/META.yml (added)
+++ branches/upstream/libtest-block-perl/current/META.yml Mon Aug 11 15:41:06 2008
@@ -1,0 +1,25 @@
+---
+name: Test-Block
+version: 0.11
+author:
+  - 'Adrian Howard <adrianh at quietstars.com>'
+abstract: Specify fine granularity test plans
+license: perl
+resources:
+  license: http://dev.perl.org/licenses/
+requires:
+  Test::Builder: 0.17
+  Test::Builder::Tester: 1.01
+  Test::Exception: 0.15
+  Test::More: 0.47
+  perl: 5.6.1
+provides:
+  Test::Block:
+    file: lib/Test/Block.pm
+    version: 0.11
+  Test::Block::Plan:
+    file: lib/Test/Block.pm
+generated_by: Module::Build version 0.2805
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.2.html
+  version: 1.2

Added: branches/upstream/libtest-block-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/Makefile.PL?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/Makefile.PL (added)
+++ branches/upstream/libtest-block-perl/current/Makefile.PL Mon Aug 11 15:41:06 2008
@@ -1,0 +1,17 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+          'NAME' => 'Test::Block',
+          'VERSION_FROM' => 'lib/Test/Block.pm',
+          'PREREQ_PM' => {
+                           'Test::Builder' => '0.17',
+                           'Test::Builder::Tester' => '1.01',
+                           'Test::Exception' => '0.15',
+                           'Test::More' => '0.47'
+                         },
+          'INSTALLDIRS' => 'site',
+          'EXE_FILES' => [],
+          'PL_FILES' => {}
+        )
+;

Added: branches/upstream/libtest-block-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/README?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/README (added)
+++ branches/upstream/libtest-block-perl/current/README Mon Aug 11 15:41:06 2008
@@ -1,0 +1,240 @@
+NAME
+    Test::Block - Specify fine granularity test plans
+
+SYNOPSIS
+      use Test::More 'no_plan';
+      use Test::Block qw($Plan);
+
+      {
+          # This block should run exactly two tests
+          local $Plan = 2;
+          pass 'first test';
+          # oops. forgot second test
+      };
+
+      SKIP: {
+          local $Plan = 3;
+          pass('first test in second block');
+          skip "skip remaining tests" => $Plan;
+      };
+
+      ok( Test::Block->all_in_block, 'all test run in blocks' );
+      is( Test::Block->block_count, 2, 'two blocks ran' );
+
+      # This produces...
+      
+  ok 1 - first test
+      not ok 2 - block expected 2 test(s) and ran 1
+      #     Failed test (foo.pl at line 6)
+      ok 3 - first test in second block
+      ok 4 # skip skip remaining tests
+      ok 5 # skip skip remaining tests
+      ok 6 - all test run in blocks
+      ok 7 - two blocks ran
+      1..7
+      # Looks like you failed 1 tests of 7.
+
+DESCRIPTION
+    This module allows you to specify the number of expected tests at a
+    finer level of granularity than an entire test script. It is built with
+    Test::Builder and plays happily with Test::More and friends.
+
+    If you are not already familiar with Test::More now would be the time to
+    go take a look.
+
+  Creating test blocks
+    Test::Block supplies a special variable $Plan that you can localize to
+    specify the number of tests in a block like this:
+
+        use Test::More 'no_plan';
+        use Test::Block qw($Plan);
+        
+    {
+            local $Plan = 2;
+            pass('first test');
+            pass('second test');
+        };
+
+  What if the block runs a different number of tests?
+    If a block doesn't run the number of tests specified in $Plan then
+    Test::Block will automatically produce a failing test. For example:
+
+        {
+            local $Plan = 2;
+            pass('first test');
+            # oops - forgot second test
+        };
+
+    will output
+
+        ok 1 - first test
+        not ok 2 - block 1 expected 2 test(s) and ran 1
+
+  Tracking the number of remaining tests
+    During the execution of a block $Plan will contain the number of
+    remaining tests that are expected to run so:
+
+        {
+            local $Plan = 2;
+            diag "$Plan tests to run";
+            pass('first test');
+            diag "$Plan tests to run";
+            pass('second test');
+            diag "$Plan tests to run";
+        };
+
+    will produce
+
+        # 2 tests to run
+        ok 1 - first test
+        # 1 tests to run
+        ok 2 - second test
+        # 0 tests to run
+
+    This can make skip blocks easier to write and maintain, for example:
+
+        SKIP: {
+            local $Plan = 5;
+            pass('first test');
+            pass('second test');
+            skip "debug tests" => $Plan unless DEBUG > 0;
+            pass('third test');
+            pass('fourth test');
+            skip "high level debug tests" => $Plan unless DEBUG > 2;
+            pass('fifth test');
+        };
+
+  Named blocks
+    To make debugging easier you can give your blocks an optional name like
+    this:
+
+        {
+            local $Plan = { example => 2 };
+            pass('first test');
+            # oops - forgot second test
+        };
+
+    which would output
+
+        ok 1 - first test
+        not ok 2 - block example expected 2 test(s) and ran 1
+
+  Test::Block objects
+    The $Plan is implemented using a tied variable that stores and retrieves
+    Test::Block objects. If you want to avoid the tied interface you can use
+    Test::Block objects directly.
+
+    plan
+          # create a block expecting 4 tests
+          my $block = Test::Block->plan(4);
+
+          # create a named block with two tests
+          my $block = Test::Block->plan('test name' => 2);
+
+        You create Test::Block objects with the "plan" method. When the
+        object is destroyed it outputs a failing test if the expected number
+        of tests have not run.
+
+    remaining
+        You can find out the number of remaining tests in the block by
+        calling the "remaining" method on the object.
+
+        Test::Block objects overload "" and "0+" to return the result of the
+        remaining method.
+
+    builder
+        Returns Test::Builder object used by Test::Block. For example:
+
+          Test::Block->builder->skip('skip a test');
+
+        See Test::Builder for more information.
+
+    block_count
+        A class method that returns the number of blocks that have been
+        created. You can use this to check that the expected number of
+        blocks have run by doing something like:
+
+          is( Test::Block->block_count, 5, 'five blocks run' );
+
+        at the end of your test script.
+
+    all_in_block
+        Returns true if all tests so far run have been inside the scope of a
+        Test::Block object.
+
+          ok( Test::Block->all_in_block, 'all tests run in blocks' );
+
+BUGS
+    None known at the time of writing.
+
+    If you find any please let me know by e-mail, or report the problem with
+    <http://rt.cpan.org/>.
+
+COMMUNITY
+    perl-qa
+        If you are interested in testing using Perl I recommend you visit
+        <http://qa.perl.org/> and join the excellent perl-qa mailing list.
+        See <http://lists.perl.org/showlist.cgi?name=perl-qa> for details on
+        how to subscribe.
+
+    perlmonks
+        You can find users of Test::Block, including the module author, on
+        <http://www.perlmonks.org/>. Feel free to ask questions on
+        Test::Block there.
+
+    CPAN::Forum
+        The CPAN Forum is a web forum for discussing Perl's CPAN modules.
+        The Test::Block forum can be found at
+        <http://www.cpanforum.com/dist/Test-Block>.
+
+    AnnoCPAN
+        AnnoCPAN is a web site that allows community annotations of Perl
+        module documentation. The Test::Block annotations can be found at
+        <http://annocpan.org/~ADIE/Test-Block/>.
+
+TO DO
+    If you think this module should do something that it doesn't (or does
+    something that it shouldn't) please let me know.
+
+    You can see my current to do list at
+    <http://adrianh.tadalist.com/lists/public/15423>, with an RSS feed of
+    changes at <http://adrianh.tadalist.com/lists/feed_public/15423>.
+
+ACKNOWLEDGMENTS
+    Thanks to chromatic and Michael G Schwern for the excellent
+    Test::Builder, without which this module wouldn't be possible.
+
+    Thanks to Michael G Schwern and Tony Bowden for the mails on
+    perl-qa at perl.org that sparked the idea for this module. Thanks to Fergal
+    Daly for suggesting named blocks. Thanks to Michael G Schwern for
+    suggesting $Plan. Thanks to Nadim Khemir for feedback.
+
+AUTHOR
+    Adrian Howard <adrianh at quietstars.com>
+
+    If you can spare the time, please drop me a line if you find this module
+    useful.
+
+SEE ALSO
+    Test::Group
+        A framework for grouping related tests in a test suite
+
+    Test::Class
+        Test::Class is an xUnit testing framework for Perl. It allows you to
+        group tests into methods with independent test plans.
+
+    Test::Builder
+        Support module for building test libraries.
+
+    Test::Simple & Test::More
+        Basic utilities for writing tests.
+
+    <http://qa.perl.org/test-modules.html>
+        Overview of some of the many testing modules available on CPAN.
+
+LICENCE
+    Copyright 2003-2006 Adrian Howard, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify it
+    under the same terms as Perl itself.
+

Added: branches/upstream/libtest-block-perl/current/lib/Test/Block.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/lib/Test/Block.pm?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/lib/Test/Block.pm (added)
+++ branches/upstream/libtest-block-perl/current/lib/Test/Block.pm Mon Aug 11 15:41:06 2008
@@ -1,0 +1,359 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+package Test::Block;
+use base qw(Exporter);
+
+our @EXPORT_OK = qw($Plan);
+
+use Carp;
+use Test::Builder;
+use Scalar::Util qw( looks_like_number );
+use overload 
+    q{""} => \&remaining,
+    q{+0} => \&remaining, 
+    fallback => 1;
+
+our $VERSION = '0.11';
+
+my $Last_test_in_previous_block = 0;
+my $Active_block_count = 0;
+
+my $Test_builder = Test::Builder->new;
+sub builder { $Test_builder };
+
+my $Block_count = 0;
+sub block_count { $Block_count };
+
+sub plan {
+    my $class = shift;
+    my ($expected_tests, $name) = (pop, pop);
+    croak "need expected number of tests"
+        unless $expected_tests && $expected_tests =~ /^\d+$/s;
+    $Block_count++;
+    $Active_block_count++;
+    return bless {
+        name            => defined $name ? $name : $Block_count,
+        expected_tests  => $expected_tests,
+        initial_test    => $Test_builder->current_test,
+    }, $class;
+}
+
+sub _tests_run_in_block {
+    my $self = shift;
+    return $Test_builder->current_test - $self->{initial_test}
+}
+
+sub remaining { 
+    my $self = shift;
+    return $self->{expected_tests} - _tests_run_in_block($self);
+}
+
+sub DESTROY {
+    my $self = shift;
+    $Active_block_count--;
+    $Last_test_in_previous_block = $Test_builder->current_test;
+    my $expected = $self->{expected_tests};
+    my $name = $self->{name};
+    my $tests_ran = _tests_run_in_block($self);
+    $name = "'$name'" unless looks_like_number( $name );
+    $Test_builder->ok(
+        0, 
+        "block $name expected $expected test(s) and ran $tests_ran"
+    ) unless $tests_ran == $expected;
+}
+
+
+my $All_tests_in_block = 1;
+sub all_in_block { 
+    return unless $All_tests_in_block;
+    return 1 if $Active_block_count > 0;
+    $All_tests_in_block = 
+        $Last_test_in_previous_block == $Test_builder->current_test;
+    return $All_tests_in_block
+}
+
+
+{
+    package Test::Block::Plan;
+    use Tie::Scalar;
+    use base qw(Tie::StdScalar);    
+
+    sub STORE {
+        my ($self, $plan) = @_;
+        if ( defined($plan) && ! eval { $plan->isa( 'Test::Block' ) } ) {
+            $plan = Test::Block->plan( ref($plan) ? %$plan : $plan );
+        };
+        $self->SUPER::STORE($plan);
+    }
+}
+
+our $Plan;
+tie $Plan, 'Test::Block::Plan';
+
+1;
+__END__
+
+=head1 NAME
+
+Test::Block - Specify fine granularity test plans
+
+=head1 SYNOPSIS
+
+  use Test::More 'no_plan';
+  use Test::Block qw($Plan);
+
+  {
+      # This block should run exactly two tests
+      local $Plan = 2;
+      pass 'first test';
+      # oops. forgot second test
+  };
+
+  SKIP: {
+      local $Plan = 3;
+      pass('first test in second block');
+      skip "skip remaining tests" => $Plan;
+  };
+
+  ok( Test::Block->all_in_block, 'all test run in blocks' );
+  is( Test::Block->block_count, 2, 'two blocks ran' );
+
+  # This produces...
+  
+  ok 1 - first test
+  not ok 2 - block expected 2 test(s) and ran 1
+  #     Failed test (foo.pl at line 6)
+  ok 3 - first test in second block
+  ok 4 # skip skip remaining tests
+  ok 5 # skip skip remaining tests
+  ok 6 - all test run in blocks
+  ok 7 - two blocks ran
+  1..7
+  # Looks like you failed 1 tests of 7.
+
+
+=head1 DESCRIPTION
+
+This module allows you to specify the number of expected tests at a finer level of granularity than an entire test script. It is built with L<Test::Builder> and plays happily with L<Test::More> and friends.
+
+If you are not already familiar with L<Test::More> now would be the time to go take a look.
+
+
+=head2 Creating test blocks
+
+Test::Block supplies a special variable C<$Plan> that you can localize to specify the number of tests in a block like this:
+
+    use Test::More 'no_plan';
+    use Test::Block qw($Plan);
+    
+    {
+        local $Plan = 2;
+        pass('first test');
+        pass('second test');
+    };
+    
+=head2 What if the block runs a different number of tests?
+    
+If a block doesn't run the number of tests specified in C<$Plan> then Test::Block will automatically produce a failing test. For example:
+
+    {
+        local $Plan = 2;
+        pass('first test');
+        # oops - forgot second test
+    };
+
+will output
+
+    ok 1 - first test
+    not ok 2 - block 1 expected 2 test(s) and ran 1
+
+=head2 Tracking the number of remaining tests
+
+During the execution of a block C<$Plan> will contain the number of remaining tests that are expected to run so:
+
+    {
+        local $Plan = 2;
+        diag "$Plan tests to run";
+        pass('first test');
+        diag "$Plan tests to run";
+        pass('second test');
+        diag "$Plan tests to run";
+    };
+
+will produce
+
+    # 2 tests to run
+    ok 1 - first test
+    # 1 tests to run
+    ok 2 - second test
+    # 0 tests to run
+
+This can make skip blocks easier to write and maintain, for example:
+
+    SKIP: {
+        local $Plan = 5;
+        pass('first test');
+        pass('second test');
+        skip "debug tests" => $Plan unless DEBUG > 0;
+        pass('third test');
+        pass('fourth test');
+        skip "high level debug tests" => $Plan unless DEBUG > 2;
+        pass('fifth test');
+    };
+
+
+=head2 Named blocks
+
+To make debugging easier you can give your blocks an optional name like this:
+
+    {
+        local $Plan = { example => 2 };
+        pass('first test');
+        # oops - forgot second test
+    };
+
+which would output
+
+    ok 1 - first test
+    not ok 2 - block example expected 2 test(s) and ran 1
+
+
+=head2 Test::Block objects
+
+The C<$Plan> is implemented using a tied variable that stores and retrieves Test::Block objects. If you want to avoid the tied interface you can use Test::Block objects directly.
+
+=over 4
+
+=item B<plan>
+
+  # create a block expecting 4 tests
+  my $block = Test::Block->plan(4);
+
+  # create a named block with two tests
+  my $block = Test::Block->plan('test name' => 2);
+
+You create Test::Block objects with the C<plan> method. When the object is destroyed it outputs a failing test if the expected number of tests have not run. 
+
+
+=item B<remaining>
+
+You can find out the number of remaining tests in the block by calling the C<remaining> method on the object. 
+
+Test::Block objects overload C<""> and C<0+> to return the result of the remaining method.
+
+
+=item B<builder>
+
+Returns L<Test::Builder> object used by Test::Block. For example:
+
+  Test::Block->builder->skip('skip a test');
+
+See L<Test::Builder> for more information.
+
+
+=item B<block_count>
+
+A class method that returns the number of blocks that have been created. You can use this to check that the expected number of blocks have run by doing something like:
+
+  is( Test::Block->block_count, 5, 'five blocks run' );
+
+at the end of your test script.
+
+
+=item B<all_in_block>
+
+Returns true if all tests so far run have been inside the scope of a Test::Block object.
+
+  ok( Test::Block->all_in_block, 'all tests run in blocks' );
+
+=back
+
+
+=head1 BUGS
+
+None known at the time of writing. 
+
+If you find any please let me know by e-mail, or report the problem with L<http://rt.cpan.org/>.
+
+
+=head1 COMMUNITY
+
+=over 4
+
+=item perl-qa
+
+If you are interested in testing using Perl I recommend you visit L<http://qa.perl.org/> and join the excellent perl-qa mailing list. See L<http://lists.perl.org/showlist.cgi?name=perl-qa> for details on how to subscribe.
+
+=item perlmonks
+
+You can find users of Test::Block, including the module author, on  L<http://www.perlmonks.org/>. Feel free to ask questions on Test::Block there.
+
+=item CPAN::Forum
+
+The CPAN Forum is a web forum for discussing Perl's CPAN modules.   The Test::Block forum can be found at L<http://www.cpanforum.com/dist/Test-Block>.
+
+=item AnnoCPAN
+
+AnnoCPAN is a web site that allows community annotations of Perl module documentation. The Test::Block annotations can be found at L<http://annocpan.org/~ADIE/Test-Block/>.
+
+=back
+
+=head1 TO DO
+
+If you think this module should do something that it doesn't (or does something that it shouldn't) please let me know.
+
+You can see my current to do list at L<http://adrianh.tadalist.com/lists/public/15423>, with an RSS feed of changes at L<http://adrianh.tadalist.com/lists/feed_public/15423>.
+
+
+=head1 ACKNOWLEDGMENTS
+
+Thanks to chromatic and Michael G Schwern for the excellent Test::Builder, without which this module wouldn't be possible.
+
+Thanks to Michael G Schwern and Tony Bowden for the mails on perl-qa at perl.org that sparked the idea for this module. Thanks to Fergal Daly for suggesting named blocks. Thanks to Michael G Schwern for suggesting $Plan. Thanks to Nadim Khemir for feedback.
+
+
+=head1 AUTHOR
+
+Adrian Howard <adrianh at quietstars.com>
+
+If you can spare the time, please drop me a line if you find this module useful.
+
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Test::Group>
+
+A framework for grouping related tests in a test suite
+
+=item L<Test::Class>
+
+Test::Class is an xUnit testing framework for Perl. It allows you to group tests into methods with independent test plans.
+
+=item L<Test::Builder>
+
+Support module for building test libraries.
+
+=item L<Test::Simple> & L<Test::More>
+
+Basic utilities for writing tests.
+
+=item L<http://qa.perl.org/test-modules.html>
+
+Overview of some of the many testing modules available on CPAN.
+
+=back
+
+
+=head1 LICENCE
+
+Copyright 2003-2006 Adrian Howard, All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+=cut
+

Added: branches/upstream/libtest-block-perl/current/t/all_in_block.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/all_in_block.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/all_in_block.t (added)
+++ branches/upstream/libtest-block-perl/current/t/all_in_block.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,23 @@
+use strict;
+use warnings;
+use Test::More tests => 6;
+use Test::Block qw($Plan);
+
+{
+	local $Plan = 1;
+	ok( Test::Block->all_in_block, 'true at start');
+};
+{
+	local $Plan = 1;
+	ok( Test::Block->all_in_block, 'true after a block');
+};
+ok( Test::Block->all_in_block, 'true immediately outside a block');
+ok(!Test::Block->all_in_block, 'false after non-block test');
+{
+	local $Plan = 1;
+	ok( !Test::Block->all_in_block, 'still false in next block');
+};
+{
+	local $Plan = 1;
+	ok( !Test::Block->all_in_block, 'still false in following block');
+};

Added: branches/upstream/libtest-block-perl/current/t/bad_args.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/bad_args.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/bad_args.t (added)
+++ branches/upstream/libtest-block-perl/current/t/bad_args.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,15 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More 'no_plan';
+use Test::Exception;
+
+BEGIN { use_ok ('Test::Block') };
+
+dies_ok { Test::Block->plan } 'must specify num tests to run';
+dies_ok { Test::Block->plan('foo') } 
+    'value only num tests must be a number';
+dies_ok { Test::Block->plan(tests => 'foo') }
+    'key/value num tests must be a number';
+dies_ok { Test::Block->plan('44d') } "44d isn't a number either";

Added: branches/upstream/libtest-block-perl/current/t/block.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/block.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/block.t (added)
+++ branches/upstream/libtest-block-perl/current/t/block.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,65 @@
+use strict;
+use warnings;
+use Test::Builder::Tester tests => 6;
+use Test::More;
+use Test::Block;
+
+test_out('ok 1');
+{
+	my $block = Test::Block->plan(1);
+	ok(1);
+}
+test_test("count okay");
+
+
+test_out('ok 1');
+test_out('not ok 2 - block 2 expected 2 test(s) and ran 1');
+test_fail(+2);
+{
+	my $block = Test::Block->plan(2);
+	ok(1);
+}
+test_test("too few tests");
+
+
+test_out('ok 1');
+test_out('ok 2');
+test_out('not ok 3 - block 3 expected 1 test(s) and ran 2');
+test_fail(+2);
+{
+	my $block = Test::Block->plan(1);
+	ok(1);
+	ok(1);
+}
+test_test("too many tests");
+
+
+test_out('ok 1');
+test_out('ok 2 # skip test');
+test_out('ok 3 # skip test');
+SKIP: {
+	my $block = Test::Block->plan(3);
+	ok(1);
+	skip "test" => $block->remaining;
+}
+test_test("works with skipped tests");
+
+
+test_out('ok 1');
+{
+	my $block = Test::Block->plan(1);
+	{
+		my $block = Test::Block->plan(1);
+		ok(1);
+	}
+}
+test_test("nested blocks");
+
+test_out('ok 1');
+test_out("not ok 2 - block 'foo' expected 2 test(s) and ran 1");
+test_fail(+2);
+{
+	my $block = Test::Block->plan(foo => 2);
+	ok(1);
+}
+test_test("named block");

Added: branches/upstream/libtest-block-perl/current/t/class_methods.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/class_methods.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/class_methods.t (added)
+++ branches/upstream/libtest-block-perl/current/t/class_methods.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,16 @@
+use strict;
+use warnings;
+use Test::More tests => 5;
+use Test::Builder;
+
+BEGIN { use_ok 'Test::Block' };
+
+is( Test::Block->block_count, 0, 'block count initially zero');
+
+SKIP: {
+	my $block = Test::Block->plan(1);
+	pass('pass');
+};
+
+is( Test::Block->block_count, 1, 'block count updated');
+is( Test::Builder->new, Test::Block->builder, 'builder' );

Added: branches/upstream/libtest-block-perl/current/t/developer/documented.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/developer/documented.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/developer/documented.t (added)
+++ branches/upstream/libtest-block-perl/current/t/developer/documented.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,9 @@
+#! /usr/bin/perl -Tw
+
+use strict;
+use warnings;
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Propchange: branches/upstream/libtest-block-perl/current/t/developer/documented.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-block-perl/current/t/developer/perlcritic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/developer/perlcritic.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/developer/perlcritic.t (added)
+++ branches/upstream/libtest-block-perl/current/t/developer/perlcritic.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,11 @@
+#! /usr/bin/perl -Tw
+
+use strict;
+use warnings;
+
+use Test::More;
+eval "use Test::Perl::Critic (-profile => 't/developer/perlcriticrc')";
+plan skip_all => "Test::Perl::Critic required for criticism" if $@;
+all_critic_ok();
+
+

Added: branches/upstream/libtest-block-perl/current/t/developer/perlcriticrc
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/developer/perlcriticrc?rev=24127&op=file
==============================================================================
    (empty)

Added: branches/upstream/libtest-block-perl/current/t/developer/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/developer/pod.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/developer/pod.t (added)
+++ branches/upstream/libtest-block-perl/current/t/developer/pod.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,9 @@
+#! /usr/bin/perl -Tw
+
+use strict;
+use warnings;
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();

Propchange: branches/upstream/libtest-block-perl/current/t/developer/pod.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-block-perl/current/t/developer/spelling.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/developer/spelling.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/developer/spelling.t (added)
+++ branches/upstream/libtest-block-perl/current/t/developer/spelling.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+my $aspell_path = eval q{
+    use Test::Spelling; 
+    use File::Which;
+    which('aspell') || die 'no aspell'
+};
+plan skip_all => 'Optional Test::Spelling, File::Which and aspell program required to spellcheck POD' if $@;
+set_spell_cmd("$aspell_path list");
+add_stopwords( <DATA> );
+all_pod_files_spelling_ok();
+
+__DATA__
+Daly
+Fergal
+Khemir
+Nadim
+CPAN
+LICENCE
+RSS
+perlmonks
+qa
+xUnit
+AnnoCPAN
+Bowden
+ACKNOWLEDGMENTS

Added: branches/upstream/libtest-block-perl/current/t/import.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/import.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/import.t (added)
+++ branches/upstream/libtest-block-perl/current/t/import.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,11 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Test::Block', qw($Plan) };
+
+{
+	local $Plan = 2;
+	isa_ok( $Plan, 'Test::Block', '$Plan' );
+	is $Plan, 1, '$Plan holds remaining number of tests';
+}

Added: branches/upstream/libtest-block-perl/current/t/variable.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-block-perl/current/t/variable.t?rev=24127&op=file
==============================================================================
--- branches/upstream/libtest-block-perl/current/t/variable.t (added)
+++ branches/upstream/libtest-block-perl/current/t/variable.t Mon Aug 11 15:41:06 2008
@@ -1,0 +1,23 @@
+use strict;
+use warnings;
+use Test::Builder::Tester tests => 1;
+use Test::More;
+use Test::Block;
+
+test_out("ok 1 - remaining set");
+test_out("not ok 2 - block 'inner' expected 1 test(s) and ran 0");
+test_fail(+8);
+test_out("ok 3 - remaining updated");
+test_out("ok 4 # skip last test");
+test_out("ok 5 - block count correct");
+SKIP: {
+	local $Test::Block::Plan = 4;
+	is( $Test::Block::Plan, 4, 'remaining set' );
+	{
+		local $Test::Block::Plan = { inner => 1 };
+	}
+	is( $Test::Block::Plan, 2, 'remaining updated' );
+	skip 'last test', $Test::Block::Plan;
+};
+is( Test::Block->block_count, 2, 'block count correct');
+test_test('$Test::Block::Plan');




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