summaryrefslogtreecommitdiff
path: root/t/op/utf8decode.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-03-12 16:23:32 +0000
committerNicholas Clark <nick@ccl4.org>2011-03-12 16:23:32 +0000
commitdeaabfbb31a16ea25dbcf2eeeccec817bd469adf (patch)
treedf4fc7e1396230a267c348b990b23e26d5823c65 /t/op/utf8decode.t
parent04f3c60895040abc3f378493da2af39f48e56714 (diff)
downloadperl-deaabfbb31a16ea25dbcf2eeeccec817bd469adf.tar.gz
In utf8decode.t, use //x to add comments to the parsing regexp.
Also, assign directly to variables, instead of going via $1 to $7.
Diffstat (limited to 't/op/utf8decode.t')
-rw-r--r--t/op/utf8decode.t12
1 files changed, 9 insertions, 3 deletions
diff --git a/t/op/utf8decode.t b/t/op/utf8decode.t
index 8e6f8532ba..ba785fa10a 100644
--- a/t/op/utf8decode.t
+++ b/t/op/utf8decode.t
@@ -23,9 +23,15 @@ no utf8;
foreach (<DATA>) {
if (/^(?:\d+(?:\.\d+)?)\s/ || /^#/) {
# print "# $_\n";
- } elsif (/^(\d+\.\d+\.\d+[bu]?)\s+(y|n|N-?\d+)\s+([0-9a-f]{1,8}(?:,[0-9a-f]{1,8})*|-)\s+(\d+)\s+([0-9a-f]{2}(?::[0-9a-f]{2})*)\s+(\d+|-)(?:\s+(.+))?$/) {
- my ($id, $okay, $Unicode, $byteslen, $hex, $charslen, $experr) =
- ($1, $2, $3, $4, $5, $6, $7);
+ } elsif (my ($id, $okay, $Unicode, $byteslen, $hex, $charslen, $experr)
+ = /^(\d+\.\d+\.\d+[bu]?) # ID
+ \s+(y|n|N-?\d+) # expect to pass or fail
+ \s+([0-9a-f]{1,8}(?:,[0-9a-f]{1,8})*|-) # Unicode characters
+ \s+(\d+) # number of octets
+ \s+([0-9a-f]{2}(?::[0-9a-f]{2})*) # octets in hex
+ \s+(\d+|-) # number of characters
+ (?:\s+(.+))? # expected error (or comment)
+ $/x) {
my @hex = split(/:/, $hex);
is(scalar @hex, $byteslen, 'Amount of hex tallies with byteslen');
my $octets = join '', map {chr hex $_} @hex;