From 8fbf143586f593a5f599f1b633dc558b7269a3a7 Mon Sep 17 00:00:00 2001 From: James E Keenan Date: Sun, 15 Sep 2024 12:51:20 -0400 Subject: [PATCH] Add 2 unit tests from pull request GH #22597 Added to the commit immediately preceding the commit which the poster states broke utf8n_to_uvchr, without adding code changes from that p.r. --- t/op/lex.t | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/t/op/lex.t b/t/op/lex.t index e78fad2c42fc..a5703fc53e98 100644 --- a/t/op/lex.t +++ b/t/op/lex.t @@ -7,7 +7,8 @@ use warnings; BEGIN { chdir 't' if -d 't'; require './test.pl'; } -plan(tests => 36); +#plan(tests => 36); +plan(tests => 38); { print <<''; # Yow! @@ -284,3 +285,20 @@ EOM fresh_perl_like('flock _$', qr/Not enough arguments for flock/, {stderr => 1}, "[perl #129190] intuit_method() invalidates PL_bufptr"); + +# test-driven development; first, add the tests from GH #22597 + + +fresh_perl_like( + qq(use utf8; \xC2\xE3\x81\x82), + qr/^Malformed UTF-8 character:/, + {stderr => 1}, + 'Error handling for invalid UTF-8 sequences starting with leading bytes', +); + +fresh_perl_like( + qq(use utf8; \xFF\xE3\x81\x82), + qr/^Malformed UTF-8 character:/, + {stderr => 1}, + 'Error handling for invalid UTF-8 sequences starting with unassigned bytes', +);