pat_advanced.t: fix two tests
authorFather Chrysostomos <sprout@cpan.org>
Mon, 27 May 2013 15:44:34 +0000 (08:44 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 27 May 2013 15:45:01 +0000 (08:45 -0700)
If two pieces of code are executed to see if they produce exactly the
same warning, the scalar holding the warning needs to be cleared in
between, otherwise the second test is useless if the first one passes
and the second piece of code doesn’t warn.

t/re/pat_advanced.t

index 3440a32..4f72a9e 100644 (file)
@@ -1020,6 +1020,7 @@ sub run_tests {
         undef $w;
         eval q [is("\N{TOO  MANY SPACES}", "TOO  MANY SPACES", "Multiple spaces in character name works")];
         like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
+        undef $w;
         eval q [use utf8; is("\N{TOO  MANY SPACES}", "TOO  MANY SPACES", "Same under 'use utf8': they work")];
         like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... but return a deprecation warning");
         {
@@ -1051,6 +1052,7 @@ sub run_tests {
         undef $w;
         eval q [is("\N{TRAILING SPACE }", "TRAILING SPACE ", "Trailing space in character name works")];
         like ($w, qr/Trailing white-space in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
+        undef $w;
         eval q [use utf8; is("\N{TRAILING SPACE }", "TRAILING SPACE ", "Same under 'use utf8': they work")];
         like ($w, qr/Trailing white-space in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
         {