r77189 - in /branches/upstream/libtest-spec-perl/current: Changes MANIFEST META.yml lib/Test/Spec.pm lib/Test/Spec/Mocks.pm t/show_exceptions.t t/show_exeptions.t

ghedo-guest at users.alioth.debian.org ghedo-guest at users.alioth.debian.org
Thu Jul 7 16:22:24 UTC 2011


Author: ghedo-guest
Date: Thu Jul  7 16:22:15 2011
New Revision: 77189

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=77189
Log:
[svn-upgrade] new version libtest-spec-perl (0.36)

Added:
    branches/upstream/libtest-spec-perl/current/t/show_exceptions.t   (with props)
Removed:
    branches/upstream/libtest-spec-perl/current/t/show_exeptions.t
Modified:
    branches/upstream/libtest-spec-perl/current/Changes
    branches/upstream/libtest-spec-perl/current/MANIFEST
    branches/upstream/libtest-spec-perl/current/META.yml
    branches/upstream/libtest-spec-perl/current/lib/Test/Spec.pm
    branches/upstream/libtest-spec-perl/current/lib/Test/Spec/Mocks.pm

Modified: branches/upstream/libtest-spec-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-spec-perl/current/Changes?rev=77189&op=diff
==============================================================================
--- branches/upstream/libtest-spec-perl/current/Changes (original)
+++ branches/upstream/libtest-spec-perl/current/Changes Thu Jul  7 16:22:15 2011
@@ -1,4 +1,8 @@
 Revision history for Perl extension Test::Spec.
+
+0.36 Tue Jul 05 18:23:00 EST 2011
+  - Improved reporting of errors using spec_helper.
+  - Minor documentation formatting fixes
 
 0.35 Wed Jun 29 16:52:00 UTC 2011
   - Fixed test suite for Windows environments.

Modified: branches/upstream/libtest-spec-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-spec-perl/current/MANIFEST?rev=77189&op=diff
==============================================================================
--- branches/upstream/libtest-spec-perl/current/MANIFEST (original)
+++ branches/upstream/libtest-spec-perl/current/MANIFEST Thu Jul  7 16:22:15 2011
@@ -17,7 +17,7 @@
 t/perl_warning_spec.pl
 t/shared_examples.t
 t/shared_examples_spec.pl
-t/show_exeptions.t
+t/show_exceptions.t
 t/spec_helper.t
 t/strict_violating_spec.pl
 t/test_helper.pl

Modified: branches/upstream/libtest-spec-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-spec-perl/current/META.yml?rev=77189&op=diff
==============================================================================
--- branches/upstream/libtest-spec-perl/current/META.yml (original)
+++ branches/upstream/libtest-spec-perl/current/META.yml Thu Jul  7 16:22:15 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Test-Spec
-version:            0.35
+version:            0.36
 abstract:           Write tests in a declarative specification style
 author:
     - Philip Garrett <philip.garrett at icainformatics.com>

Modified: branches/upstream/libtest-spec-perl/current/lib/Test/Spec.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-spec-perl/current/lib/Test/Spec.pm?rev=77189&op=diff
==============================================================================
--- branches/upstream/libtest-spec-perl/current/lib/Test/Spec.pm (original)
+++ branches/upstream/libtest-spec-perl/current/lib/Test/Spec.pm Thu Jul  7 16:22:15 2011
@@ -3,7 +3,7 @@
 use warnings;
 use Test::Trap ();        # load as early as possible to override CORE::exit
 
-our $VERSION = '0.35';
+our $VERSION = '0.36';
 
 use base qw(Exporter);
 
@@ -323,10 +323,12 @@
   }
   my $sub = eval "package $callpkg;\n" . q[sub {
     my ($file,$origpath) = @_;
-    if (not defined(do $file)) {
-      my $err = $! || $@;
-      die "could not load spec_helper '$origpath': $err";
-    }
+    open(my $IN, "<", $file)
+      || die "could not open spec_helper '$origpath': $!";
+    defined(my $content = do { local $/; <$IN> })
+      || die "could not read spec_helper '$origpath': $!";
+    eval("# line 1 \"$origpath\"\n" . $content);
+    die "$@\n" if $@;
   }];
   $sub->($load_path,$filespec);
 }
@@ -662,7 +664,7 @@
 
 Defines a group of examples that can later be included in
 C<describe> blocks or other C<shared_examples_for> blocks. See
-L</Shared Example Groups>.
+L</Shared example groups>.
 
 Example group names are B<global>.
 

Modified: branches/upstream/libtest-spec-perl/current/lib/Test/Spec/Mocks.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-spec-perl/current/lib/Test/Spec/Mocks.pm?rev=77189&op=diff
==============================================================================
--- branches/upstream/libtest-spec-perl/current/lib/Test/Spec/Mocks.pm (original)
+++ branches/upstream/libtest-spec-perl/current/lib/Test/Spec/Mocks.pm Thu Jul  7 16:22:15 2011
@@ -574,14 +574,14 @@
 =item * Stub object
 
 A stub object is an object created specifically to return canned responses for
-a specific set of methods. These are created with the L<stub|/stub> function.
+a specific set of methods. These are created with the L<stub|/stub()> function.
 
 =item * Mock object
 
 Mock objects are similar to stub objects, but are programmed with both
 prepared responses and expectations for how they will be called. If the
 expectations are not met, they raise an exception to indicate that the test
-failed. Mock objects are created with the L<mock|/mock> function.
+failed. Mock objects are created with the L<mock|/mock()> function.
 
 =item * Stubbed method
 
@@ -590,7 +590,7 @@
 or class's behavior. For example, you might want to override the C<do> method
 of a DBI handle so it doesn't make changes to your database, but still need
 the handle to respond as usual to the C<quote> method.  You'll stub
-methods using the L<stubs|/stubs> method.
+methods using the L<stubs|/"$thing-E<gt>stubs($method_name)"> method.
 
 =item * Mocked method
 
@@ -599,7 +599,7 @@
 will raise an exception if not met. For example, you can mock a C<save> method
 on an object to ensure it is called by the code you are testing, while
 preventing the data from actually being committed to disk in your test. Use
-the L<expects|/expects> method to create mock methods.
+the L<expects|/"$thing-E<gt>expects($method)"> method to create mock methods.
 
 =item * "stub", "mock"
 
@@ -680,7 +680,7 @@
   };
 
 If you want something more flexible than "exactly", you can choose from
-"at_least", "at_most", "any_number" and others. See L</Mock expectations>.
+"at_least", "at_most", "any_number" and others. See L</EXPECTATION ADJUSTMENT METHODS>.
 
 
 =head2 Stubbing methods
@@ -734,11 +734,11 @@
 
 =over 4
 
-=item stub();
-
-=item stub($method_name => $result, ...);
-
-=item stub($method_name => sub { $result }, ...);
+=item stub()
+
+=item stub($method_name => $result, ...)
+
+=item stub($method_name => sub { $result }, ...)
 
 =item stub({ $method_name => $result, ... })
 
@@ -789,7 +789,7 @@
 =item mock()
 
 Returns a new blank, anonymous mock object, suitable for mocking methods with
-L<expects()|/expects()>.
+L<expects()|/"$thing-E<gt>expects($method)">.
 
   my $rect = mock();
   $rect->expects('area')->returns(100);
@@ -890,6 +890,8 @@
 
 =head1 OTHER EXPECTATION METHODS
 
+=over 4
+
 =item verify
 
 Allows you to verify manually that the expectation was met. If the expectation
@@ -901,8 +903,6 @@
 If the expectation has not been met, returns a list of problem description
 strings. Otherwise, returns an empty list.
 
-=over 4
-
 =back
 
 =head1 SEE ALSO

Added: branches/upstream/libtest-spec-perl/current/t/show_exceptions.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-spec-perl/current/t/show_exceptions.t?rev=77189&op=file
==============================================================================
--- branches/upstream/libtest-spec-perl/current/t/show_exceptions.t (added)
+++ branches/upstream/libtest-spec-perl/current/t/show_exceptions.t Thu Jul  7 16:22:15 2011
@@ -1,0 +1,30 @@
+#!/usr/bin/env perl
+#
+# show_exceptions.t
+#
+########################################################################
+#
+
+package Testcase::Spec::ShowExceptions;
+use Test::Spec;
+use FindBin qw($Bin);
+BEGIN { require "$Bin/test_helper.pl" };
+
+describe "Test::Spec" => sub {
+  my $tap = capture_tap("dying_spec.pl");
+
+  it "should explain why a dying test failed" => sub {
+    like($tap, qr/^#   Failed test 'Test::Spec should trap die message' by dying:\s*$/m);
+  };
+  it "should echo the exception message" => sub {
+    like($tap, qr/^#     this should be displayed\s*$/m);
+  };
+  it "should report the context at which the error occurred" => sub {
+    like($tap, qr/^#     at .+? line \d+\.\s*$/m);
+  };
+  it "should continue running tests after an exception is encountered" => sub {
+    like($tap, qr/^ok \d+ - Test::Spec should continue testing/m);
+  };
+};
+
+runtests unless caller;

Propchange: branches/upstream/libtest-spec-perl/current/t/show_exceptions.t
------------------------------------------------------------------------------
    svn:executable = *




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