diff options
author | Karl Williamson <khw@cpan.org> | 2019-10-22 14:03:30 -0600 |
---|---|---|
committer | Nicolas R <atoomic@cpan.org> | 2019-11-08 12:01:13 -0700 |
commit | c5d6db5bacaf22f3f145550baae653f78aefebf4 (patch) | |
tree | 7773366a40f623045f10dd5b2b4f1f7f08bbf2da /dist/Devel-PPPort | |
parent | e3bcd10108920a993be993eb6b756a2dcaa0f35c (diff) | |
download | perl-c5d6db5bacaf22f3f145550baae653f78aefebf4.tar.gz |
parts/inc/misc: Generalize a test
The result of this commit is a loop that runs once; that will change in
two commits from now, when it runs with different values
(cherry picked from commit 1d9bacdd128c8dc51c3b54b05e9d112a39c25e4a)
Signed-off-by: Nicolas R <atoomic@cpan.org>
Diffstat (limited to 'dist/Devel-PPPort')
-rw-r--r-- | dist/Devel-PPPort/parts/inc/misc | 9 | ||||
-rw-r--r-- | dist/Devel-PPPort/t/misc.t | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/dist/Devel-PPPort/parts/inc/misc b/dist/Devel-PPPort/parts/inc/misc index aa3efb2494..6a070c21d2 100644 --- a/dist/Devel-PPPort/parts/inc/misc +++ b/dist/Devel-PPPort/parts/inc/misc @@ -2532,6 +2532,9 @@ for $i (sort { $a <=> $b } keys %code_points_to_test) { } } else { + my $sub_fcn; + for $sub_fcn ("") { + my $fcn = "Devel::PPPort::is${class}${sub_fcn}_utf8_safe"; my $utf8 = quotemeta Devel::PPPort::uvoffuni_to_utf8($i); if ("$]" < 5.007 && $native > 255) { skip("Perls earlier than 5.7 give wrong answers for above Latin1 code points", 0); @@ -2540,9 +2543,8 @@ for $i (sort { $a <=> $b } keys %code_points_to_test) { skip("Perls earlier than 5.11.3 considered high space characters as isPRINT and isGRAPH", 0); } else { - my $should_be = $types{"$native:$class"} || 0; - my $eval_string = "Devel::PPPort::is${class}_utf8_safe(\"$utf8\", 0)"; + my $eval_string = "$fcn(\"$utf8\", 0)"; my $is = eval $eval_string || 0; die "eval 'For $i, $eval_string' gave $@" if $@; ok($is, $should_be, sprintf("For U+%04X '%s'", $native, $eval_string)); @@ -2555,12 +2557,13 @@ for $i (sort { $a <=> $b } keys %code_points_to_test) { skip("Prints an annoying error message that khw doesn't know how to easily suppress", 0); } else { - my $eval_string = "Devel::PPPort::is${class}_utf8_safe(\"$utf8\", -1)"; + my $eval_string = "$fcn(\"$utf8\", -1)"; my $is = eval "no warnings; $eval_string" || 0; die "eval '$eval_string' gave $@" if $@; ok($is, 0, sprintf("For U+%04X '%s'", $native, $eval_string)); } } + } } } } diff --git a/dist/Devel-PPPort/t/misc.t b/dist/Devel-PPPort/t/misc.t index 785f27e843..54fe386010 100644 --- a/dist/Devel-PPPort/t/misc.t +++ b/dist/Devel-PPPort/t/misc.t @@ -305,6 +305,9 @@ for $i (sort { $a <=> $b } keys %code_points_to_test) { } } else { + my $sub_fcn; + for $sub_fcn ("") { + my $fcn = "Devel::PPPort::is${class}${sub_fcn}_utf8_safe"; my $utf8 = quotemeta Devel::PPPort::uvoffuni_to_utf8($i); if ("$]" < 5.007 && $native > 255) { skip("Perls earlier than 5.7 give wrong answers for above Latin1 code points", 0); @@ -313,9 +316,8 @@ for $i (sort { $a <=> $b } keys %code_points_to_test) { skip("Perls earlier than 5.11.3 considered high space characters as isPRINT and isGRAPH", 0); } else { - my $should_be = $types{"$native:$class"} || 0; - my $eval_string = "Devel::PPPort::is${class}_utf8_safe(\"$utf8\", 0)"; + my $eval_string = "$fcn(\"$utf8\", 0)"; my $is = eval $eval_string || 0; die "eval 'For $i, $eval_string' gave $@" if $@; ok($is, $should_be, sprintf("For U+%04X '%s'", $native, $eval_string)); @@ -328,12 +330,13 @@ for $i (sort { $a <=> $b } keys %code_points_to_test) { skip("Prints an annoying error message that khw doesn't know how to easily suppress", 0); } else { - my $eval_string = "Devel::PPPort::is${class}_utf8_safe(\"$utf8\", -1)"; + my $eval_string = "$fcn(\"$utf8\", -1)"; my $is = eval "no warnings; $eval_string" || 0; die "eval '$eval_string' gave $@" if $@; ok($is, 0, sprintf("For U+%04X '%s'", $native, $eval_string)); } } + } } } } |