summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-07-10 13:48:15 -0600
committerKarl Williamson <khw@cpan.org>2021-07-23 15:33:27 -0700
commit2b8c1900114c7542182e5e5f09966838e7f5a0a0 (patch)
treeec8314b7ea1feb8671a28995b53310ea206dbe98 /dist
parente3d3031dfdfd7788176400b1407108d2009e5f56 (diff)
downloadperl-2b8c1900114c7542182e5e5f09966838e7f5a0a0.tar.gz
Unicode::Normalize: Make ok() common to all .t files
There are already two functions designed for the .t files to use whose common definition is in Normalize.pm This commit moves the hand-rolled ok() there as well, so its definition is only in one place.
Diffstat (limited to 'dist')
-rw-r--r--dist/Unicode-Normalize/Normalize.pm13
-rw-r--r--dist/Unicode-Normalize/t/fcdc.t9
-rw-r--r--dist/Unicode-Normalize/t/form.t9
-rw-r--r--dist/Unicode-Normalize/t/func.t9
-rw-r--r--dist/Unicode-Normalize/t/illegal.t9
-rw-r--r--dist/Unicode-Normalize/t/norm.t9
-rw-r--r--dist/Unicode-Normalize/t/partial1.t9
-rw-r--r--dist/Unicode-Normalize/t/partial2.t9
-rw-r--r--dist/Unicode-Normalize/t/proto.t9
-rw-r--r--dist/Unicode-Normalize/t/split.t9
-rw-r--r--dist/Unicode-Normalize/t/test.t9
-rw-r--r--dist/Unicode-Normalize/t/tie.t9
12 files changed, 23 insertions, 89 deletions
diff --git a/dist/Unicode-Normalize/Normalize.pm b/dist/Unicode-Normalize/Normalize.pm
index fd6f1cb700..8d85eda63c 100644
--- a/dist/Unicode-Normalize/Normalize.pm
+++ b/dist/Unicode-Normalize/Normalize.pm
@@ -16,7 +16,7 @@ use Carp;
no warnings 'utf8';
-our $VERSION = '1.28';
+our $VERSION = '1.29';
our $PACKAGE = __PACKAGE__;
our @EXPORT = qw( NFC NFD NFKC NFKD );
@@ -52,6 +52,17 @@ sub unpack_U {
return unpack('U*', shift(@_).pack('U*'));
}
+sub ok ($$;$) {
+ my $count_ref = shift; # Test number in caller
+ my $p = my $r = shift;
+ if (@_) {
+ my $x = shift;
+ $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
+ }
+
+ print $p ? "ok" : "not ok", ' ', ++$$count_ref, "\n";
+}
+
require Exporter;
##### The above part is common to XS and PP #####
diff --git a/dist/Unicode-Normalize/t/fcdc.t b/dist/Unicode-Normalize/t/fcdc.t
index d2ef28b9e9..348f5e8ce0 100644
--- a/dist/Unicode-Normalize/t/fcdc.t
+++ b/dist/Unicode-Normalize/t/fcdc.t
@@ -23,14 +23,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..70\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/form.t b/dist/Unicode-Normalize/t/form.t
index 6bbfb082ca..1e7a96e8aa 100644
--- a/dist/Unicode-Normalize/t/form.t
+++ b/dist/Unicode-Normalize/t/form.t
@@ -23,14 +23,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..37\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/func.t b/dist/Unicode-Normalize/t/func.t
index 2bd6e504a3..b59ef31693 100644
--- a/dist/Unicode-Normalize/t/func.t
+++ b/dist/Unicode-Normalize/t/func.t
@@ -23,14 +23,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..217\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/illegal.t b/dist/Unicode-Normalize/t/illegal.t
index ccf2b4aae6..4325c681c1 100644
--- a/dist/Unicode-Normalize/t/illegal.t
+++ b/dist/Unicode-Normalize/t/illegal.t
@@ -43,14 +43,7 @@ use warnings;
BEGIN { $| = 1; print "1..113\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
ok(1);
diff --git a/dist/Unicode-Normalize/t/norm.t b/dist/Unicode-Normalize/t/norm.t
index d3cec3aea1..d9685e675f 100644
--- a/dist/Unicode-Normalize/t/norm.t
+++ b/dist/Unicode-Normalize/t/norm.t
@@ -23,14 +23,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..64\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(normalize);
diff --git a/dist/Unicode-Normalize/t/partial1.t b/dist/Unicode-Normalize/t/partial1.t
index 3e44a63dc0..aa02705fcc 100644
--- a/dist/Unicode-Normalize/t/partial1.t
+++ b/dist/Unicode-Normalize/t/partial1.t
@@ -31,14 +31,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..26\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/partial2.t b/dist/Unicode-Normalize/t/partial2.t
index 7f19e9365b..d3c24c9cf9 100644
--- a/dist/Unicode-Normalize/t/partial2.t
+++ b/dist/Unicode-Normalize/t/partial2.t
@@ -31,14 +31,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..26\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/proto.t b/dist/Unicode-Normalize/t/proto.t
index 38c6985759..7a180c8945 100644
--- a/dist/Unicode-Normalize/t/proto.t
+++ b/dist/Unicode-Normalize/t/proto.t
@@ -23,14 +23,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..48\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/split.t b/dist/Unicode-Normalize/t/split.t
index a92957c208..6c4d31129a 100644
--- a/dist/Unicode-Normalize/t/split.t
+++ b/dist/Unicode-Normalize/t/split.t
@@ -31,14 +31,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..34\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize qw(:all);
diff --git a/dist/Unicode-Normalize/t/test.t b/dist/Unicode-Normalize/t/test.t
index cb4b6ea637..15ff055d93 100644
--- a/dist/Unicode-Normalize/t/test.t
+++ b/dist/Unicode-Normalize/t/test.t
@@ -23,14 +23,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..72\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
use Unicode::Normalize;
diff --git a/dist/Unicode-Normalize/t/tie.t b/dist/Unicode-Normalize/t/tie.t
index 4fdd121e07..ea050e89a5 100644
--- a/dist/Unicode-Normalize/t/tie.t
+++ b/dist/Unicode-Normalize/t/tie.t
@@ -34,14 +34,7 @@ use strict;
use warnings;
BEGIN { $| = 1; print "1..17\n"; }
my $count = 0;
-sub ok ($;$) {
- my $p = my $r = shift;
- if (@_) {
- my $x = shift;
- $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
- }
- print $p ? "ok" : "not ok", ' ', ++$count, "\n";
-}
+sub ok { Unicode::Normalize::ok(\$count, @_) }
ok(1);