Skip to content

Commit

Permalink
Fix tests for Carp 1.25
Browse files Browse the repository at this point in the history
Before 1.25 it would not put a period at the end of the error.

For #321
  • Loading branch information
schwern committed Jun 19, 2012
1 parent a848365 commit eff48d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions t/History/History.t
Expand Up @@ -9,7 +9,8 @@ BEGIN { require 't/test.pl' }
use MyEventCoordinator;
use TB2::Result;


my $FILE = __FILE__;
my $QFILE = quotemeta($FILE);
my $CLASS = "TB2::History";
require_ok 'TB2::History';

Expand Down Expand Up @@ -71,10 +72,10 @@ note "Turn off event storage";
is $history->event_count, 3;

ok !eval { $history->events; 1 };
is $@, sprintf "Events are not stored at %s line %d.\n", __FILE__, __LINE__-1;
like $@, qr{^Events are not stored at $QFILE line @{[ __LINE__ - 1 ]}\.?\n};

ok !eval { $history->results; 1 };
is $@, sprintf "Results are not stored at %s line %d.\n", __FILE__, __LINE__-1;
like $@, qr{^Results are not stored at $QFILE line @{[ __LINE__ - 1 ]}\.?\n};

ok !eval { $history->store_events(1) }, "can't turn on storage for an existing object";
}
Expand Down
7 changes: 5 additions & 2 deletions t/History/consume.t
Expand Up @@ -5,6 +5,9 @@ use warnings;

BEGIN { require 't/test.pl' }

my $FILE = __FILE__;
my $QFILE = quotemeta($FILE);

my $CLASS = "TB2::History";
use_ok $CLASS;
use TB2::Events;
Expand Down Expand Up @@ -41,8 +44,8 @@ note "Try to consume with storage off"; {
my $h2 = $CLASS->new;

ok !eval { $h2->consume( $h1 ); 1 };
is $@, sprintf "Cannot consume() a History object which has store_events() off at %s line %d.\n",
__FILE__, __LINE__-2;
my $line = __LINE__ - 1;
like $@, qr{^Cannot consume\(\) a History object which has store_events\(\) off at $QFILE line $line\.?\n};
}

done_testing;

0 comments on commit eff48d1

Please sign in to comment.