Skip to content

Commit 68fe01a

Browse files
committed
Fix remaining TAP format issues in regex tests
- Fixed regexreplace.t to use Test::More ok() instead of manual TAP * Converted print/say patterns to ok() calls * All 12 tests now properly numbered - Fixed signatures.t to use feature 'signatures' instead of use v5.36 * Makes it compatible with Perl 5.34+ These fixes resolve 'Bad plan' and test sequence errors in prove output.
1 parent 4f178bb commit 68fe01a

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/test/resources/unit/regex/regexreplace.t

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,30 @@ $string = "Hello World\n";
5151
$pattern = qr/\n/;
5252
$replacement = "\\n";
5353
$substituted = $string =~ s/$pattern/$replacement/r;
54-
print "not " if $substituted ne "Hello World\\n"; say 'ok # \n becomes \\\\n with backslash';
54+
ok($substituted eq "Hello World\\n", '\\n becomes \\\\n with backslash');
5555

5656
###################
5757
# Tests for /r modifier bug
5858

59-
# Test 8: /r modifier with no match should return original string
59+
# /r modifier with no match should return original string
6060
$string = "Hello World";
6161
$substituted = $string =~ s/foo/bar/r;
62-
print "not " if $substituted ne "Hello World";
63-
say "ok 8 # s///r with no match returns original: got [$substituted]";
62+
ok($substituted eq "Hello World", "s///r with no match returns original: got [$substituted]");
6463

65-
# Test 9: /r modifier with pattern that doesn't match
64+
# /r modifier with pattern that doesn't match
6665
$string = "/[[=foo=]]/";
6766
$substituted = $string =~ s/ default_ (on | off) //rx;
68-
print "not " if $substituted ne "/[[=foo=]]/";
69-
say "ok 9 # s///r with non-matching pattern returns original: got [$substituted]";
67+
ok($substituted eq "/[[=foo=]]/", "s///r with non-matching pattern returns original: got [$substituted]");
7068

71-
# Test 10: /r modifier preserves original string
69+
# /r modifier preserves original string
7270
$string = "test123";
7371
$substituted = $string =~ s/123/456/r;
74-
print "not " if $string ne "test123";
75-
say "ok 10 # s///r preserves original string: [$string]";
76-
print "not " if $substituted ne "test456";
77-
say "ok 11 # s///r returns modified string: [$substituted]";
72+
ok($string eq "test123", "s///r preserves original string: [$string]");
73+
ok($substituted eq "test456", "s///r returns modified string: [$substituted]");
7874

79-
# Test 12: Empty pattern with /r
75+
# Empty pattern with /r
8076
$string = "test";
8177
$substituted = $string =~ s/nomatch//r;
82-
print "not " if $substituted ne "test";
83-
say "ok 12 # s///r with non-matching empty replacement returns original: got [$substituted]";
78+
ok($substituted eq "test", "s///r with non-matching empty replacement returns original: got [$substituted]");
8479

8580
done_testing();

0 commit comments

Comments
 (0)