Front page | perl.perl5.porters |
Postings from November 2003
[PATCH] Storable-2.08/t/code.t
Thread Next
From:
Slaven Rezic
Date:
November 9, 2003 02:11
Subject:
[PATCH] Storable-2.08/t/code.t
Message ID:
200311081526.hA8FQJgb011684@vran.herceg.de
Two changes are in this patch: all regexp tests are changed to use
qr(...) for better diagnostics, and catch error messages if Log::Agent
is installed (note that Storable has explicit Log::Agent support).
The different error messages won't cause failures if used in a perl
install (because @INC is set to a safe value), but may fail in a
standalone Storable install.
Regards,
Slaven
--- Storable-2.08/t/code.t~ Tue Jul 29 09:06:57 2003
+++ Storable-2.08/t/code.t Sat Nov 8 16:16:25 2003
@@ -118,7 +118,7 @@ ok($thawed->(), "JAPH");
######################################################################
eval { $freezed = freeze $obj[4] };
-ok($@ =~ /The result of B::Deparse::coderef2text was empty/);
+ok($@, qr/The result of B::Deparse::coderef2text was empty/);
######################################################################
# Test dclone
@@ -162,7 +162,7 @@ ok(prototype($thawed->[4]), prototype($o
$freezed = freeze $obj[$i];
$@ = "";
eval { $thawed = thaw $freezed };
- ok($@ =~ /Can\'t eval/);
+ ok($@, qr/Can\'t eval/);
}
}
@@ -172,7 +172,7 @@ ok(prototype($thawed->[4]), prototype($o
for my $i (0 .. 1) {
$@ = "";
eval { $freezed = freeze $obj[$i] };
- ok($@ =~ /Can\'t store CODE items/);
+ ok($@, qr/Can\'t store CODE items/);
}
}
@@ -184,7 +184,7 @@ ok(prototype($thawed->[4]), prototype($o
$@ = "";
eval { $thawed = thaw $freezed };
ok($@, "");
- ok($$thawed =~ /^sub/);
+ ok($$thawed, qr/^sub/);
}
}
@@ -218,7 +218,8 @@ ok(prototype($thawed->[4]), prototype($o
$freezed = freeze $obj[0]->[6];
eval { $thawed = thaw $freezed };
- ok($@ =~ /trapped/);
+ # The "Code sub ..." error message only appears if Log::Agent is installed
+ ok($@, qr/(trapped|Code sub)/);
if (0) {
# Disable or fix this test if the internal representation of Storable
@@ -234,7 +235,7 @@ ok(prototype($thawed->[4]), prototype($o
substr($freezed, -1, 0, $bad_code);
$@ = "";
eval { $thawed = thaw $freezed };
- ok($@ =~ /trapped/);
+ ok($@, qr/(trapped|Code sub)/);
}
}
--
Slaven Rezic - slaven@rezic.de
tknotes - A knotes clone, written in Perl/Tk.
http://ptktools.sourceforge.net/#tknotes
Thread Next
-
[PATCH] Storable-2.08/t/code.t
by Slaven Rezic