Skip to content

Commit

Permalink
Adjust test to cope with default regex flags stringification in 5.13.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rgs committed Sep 24, 2010
1 parent 6c9d5e3 commit 344e369
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions t/03like.t
Expand Up @@ -7,6 +7,8 @@ use Test::Builder::Tester;
use Test::Builder::Tester::Color;
use Test::LongString;

my $DEFAULT_FLAGS = $] < 5.013005 ? '-xism' : '^';

test_out("ok 1 - foo matches foo");
like_string("foo", qr/foo/, "foo matches foo");
test_test("a small string matches");
Expand All @@ -15,30 +17,30 @@ test_out("not ok 1 - foo matches foo");
test_fail(4);
test_diag(qq( got: "bar"
# length: 3
# doesn't match '(?-xism:foo)'));
# doesn't match '(?$DEFAULT_FLAGS:foo)'));
like_string("bar", qr/foo/, "foo matches foo");
test_test("a small string doesn't match");

test_out("not ok 1 - foo matches foo");
test_fail(4);
test_diag(qq( got: undef
# length: -
# doesn't match '(?-xism:foo)'));
# doesn't match '(?$DEFAULT_FLAGS:foo)'));
like_string(undef, qr/foo/, "foo matches foo");
test_test("got undef");

test_out("not ok 1 - long string matches a*");
test_fail(4);
test_diag(qq( got: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"...
# length: 100
# doesn't match '(?-xism:^a*\$)'));
# doesn't match '(?$DEFAULT_FLAGS:^a*\$)'));
like_string(("a"x60)."b".("a"x39), qr/^a*$/, "long string matches a*");
test_test("a huge string doesn't match");

test_out("not ok 1 - foo doesn't match bar");
test_fail(4);
test_diag(qq( got: "bar"
# length: 3
# matches '(?-xism:bar)'));
# matches '(?$DEFAULT_FLAGS:bar)'));
unlike_string("bar", qr/bar/, "foo doesn't match bar");
test_test("a small string matches while it shouldn't");

0 comments on commit 344e369

Please sign in to comment.