Permalink
Browse files

Accept both old and new-style regex stringification

  • Loading branch information...
1 parent 40430d5 commit 24c5b284af14c98a904266dff27b36141737ff45 Karl Williamson committed with schwern Aug 20, 2010
Showing with 20 additions and 8 deletions.
  1. +6 −0 Changes
  2. +6 −3 t/fail-like.t
  3. +8 −5 t/is_deeply_fail.t
View
@@ -1,3 +1,9 @@
+0.97_01
+ Test Fixes
+ * Adapted the tests for the new Perl 5.14 regex stringification.
+ (Karl Williamson) [github 44]
+
+
0.96 Tue Aug 10 21:13:04 PDT 2010
Bug Fixes
* You can call done_testing() again after reset() [googlecode 59]
View
@@ -44,25 +44,28 @@ Test::More->import(tests => 1);
not ok 1 - is foo like that
OUT
+ # Accept both old and new-style stringification
+ my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '\\^' : '-xism';
+
my $err_re = <<ERR;
# Failed test 'is foo like that'
# at .* line 1\.
# 'foo'
-# doesn't match '\\(\\?-xism:that\\)'
+# doesn't match '\\(\\?$modifiers:that\\)'
ERR
$TB->like($err->read, qr/^$err_re$/, 'failing errors');
}
{
- # line 59
+ # line 62
like("foo", "not a regex");
$TB->is_eq($out->read, <<OUT);
not ok 2
OUT
$TB->is_eq($err->read, <<OUT);
-# Failed test at $0 line 59.
+# Failed test at $0 line 62.
# 'not a regex' doesn't look much like a regex to me.
OUT
View
@@ -373,15 +373,18 @@ ERR
# rt.cpan.org 53469
{
-#line 377
+
+ # Accept both old and new-style stringification
+ my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '^' : '-xism';
+#line 380
ok !is_deeply( qr/a/, qr/b/, "different regexes" );
is( $out, "not ok 29 - different regexes\n" );
is( $err, <<ERR, ' right diagnostic' );
# Failed test 'different regexes'
-# at $0 line 377.
+# at $0 line 380.
# Structures begin differing at:
-# \$got = (?-xism:a)
-# \$expected = (?-xism:b)
+# \$got = (?$modifiers:a)
+# \$expected = (?$modifiers:b)
ERR
}
@@ -415,4 +418,4 @@ ERR
is( $out, "not ok 40 - {x => 0} != {x => undef}\n" );
ok !is_deeply( {x => ''}, {x => undef}, "{x => ''} != {x => undef}" );
is( $out, "not ok 41 - {x => ''} != {x => undef}\n" );
-}
+}

0 comments on commit 24c5b28

Please sign in to comment.