Silence spurious warning in new Safe test
authorRafael Garcia-Suarez <rgs@consttype.org>
Thu, 11 Feb 2010 21:36:54 +0000 (22:36 +0100)
committerRafael Garcia-Suarez <rgs@consttype.org>
Thu, 11 Feb 2010 21:36:54 +0000 (22:36 +0100)
This warning is emitted by perl when re-throwing the exception, so add a
TODO test to suppress it. However, fixing that will imply a core change.

dist/Safe/t/safesort.t

index 71d9a94..01bed36 100644 (file)
@@ -9,7 +9,7 @@ BEGIN {
 }
 
 use Safe 1.00;
-use Test::More tests => 9;
+use Test::More tests => 10;
 
 my $safe = Safe->new('PLPerl');
 $safe->permit_only(qw(:default sort));
@@ -46,6 +46,11 @@ $@ = 42;
 $die_func->();
 is $@, 42, 'successful closure call should not alter $@';
 
-ok !eval { $die_func->("died\n"); 1 }, 'should die';
-is $@, "died\n", '$@ should be set correctly';
-
+{
+    my $warns = 0;
+    local $SIG{__WARN__} = sub { $warns++ };
+    ok !eval { $die_func->("died\n"); 1 }, 'should die';
+    is $@, "died\n", '$@ should be set correctly';
+    local $TODO = "Shouldn't warn";
+    is $warns, 0;
+}