Skip to content

Commit

Permalink
Merge branch 'release/v0.40'
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Garrett committed Jan 30, 2012
2 parents 9c27e17 + ef9d887 commit 6207a4b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Changes
@@ -1,6 +1,11 @@
Revision history for Perl extension Test::Spec.

0.38 Wed Aug 31 00:52:00 EST 2011
0.40 Mon Jan 30 18:38:00 EST 2012
- Fixed problem that caused Test::Spec usage errors (e.g. 'describe "foo";'
without a subroutine argument) to be reported from inside the library,
instead of the caller's perspective where the actual error is.

0.39 Wed Aug 31 00:52:00 EST 2011
- Added xit/xthey/xdescribe to mark TODO tests, inspired by the
Jasmine JavaScript framework.
Contributed by Marian Schubert (issue #10).
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -26,3 +26,4 @@ t/show_exceptions.t
t/spec_helper.t
t/strict_violating_spec.pl
t/test_helper.pl
t/uncompilable_spec.pl
9 changes: 7 additions & 2 deletions lib/Test/Spec.pm
Expand Up @@ -3,7 +3,7 @@ use strict;
use warnings;
use Test::Trap (); # load as early as possible to override CORE::exit

our $VERSION = '0.39';
our $VERSION = '0.40';

use base qw(Exporter);

Expand Down Expand Up @@ -68,7 +68,12 @@ sub import {
return;
}

eval "package $callpkg; use base 'Test::Spec';";
eval qq{
package $callpkg;
use base 'Test::Spec';
# allow Test::Spec usage errors to be reported via Carp
our \@CARP_NOT = qw($callpkg);
};
die $@ if $@;
Test::Spec::ExportProxy->export_to_level(1, $callpkg);
$class->export_to_level(1, $callpkg);
Expand Down
5 changes: 5 additions & 0 deletions t/show_exceptions.t
Expand Up @@ -25,6 +25,11 @@ describe "Test::Spec" => sub {
it "should continue running tests after an exception is encountered" => sub {
like($tap, qr/^ok \d+ - Test::Spec should continue testing/m);
};

it "should report usage errors from the location of the error" => sub {
my ($utap) = split /[\r\n]+/, capture_tap("uncompilable_spec.pl");
like($utap, qr/at .*uncompilable_spec.pl line \d+/);
};
};

runtests unless caller;
15 changes: 15 additions & 0 deletions t/uncompilable_spec.pl
@@ -0,0 +1,15 @@
#!/usr/bin/env perl
#
# uncompilable_spec.pl
#
# Expected to fail and report Test::Spec usage error from the correct stack
# frame (i.e. "at uncompilable_spec.pl line 13").
#
########################################################################
#

use Test::Spec;

describe "Test::Spec";

runtests unless caller;

0 comments on commit 6207a4b

Please sign in to comment.