develooper Front page | perl.perl5.porters | Postings from December 2017

PATCH remove PERL_CORE boilerplate from tests

From:
Chris 'BinGOs' Williams
Date:
December 12, 2017 14:08
Subject:
PATCH remove PERL_CORE boilerplate from tests
Message ID:
20171212140801.GA15192@bingosnet.co.uk
I opened this ticket for Digest-SHA

https://rt.cpan.org/Public/Bug/Display.html?id=123863

Cheers.

----- Forwarded message from Chris 'BinGOs' Williams <bingos@bingosnet.co.uk> -----

Date: Tue, 12 Dec 2017 13:59:54 +0000
From: Chris 'BinGOs' Williams <bingos@bingosnet.co.uk>
To: bug-Digest-SHA@rt.cpan.org
Subject: PATCH remove PERL_CORE boilerplate from tests
User-Agent: Mutt/1.5.21 (2010-09-15)

Hi,

Whilst updating Digest-SHA in core today I found that recent changes to the test files
was causing failures in all the tests.

Removing the PERL_CORE boiler-plate resolved the issue.

I believe that this hasn't been required for a long while now.

Attached is a patch to fix the tests.

Have confirmed it resolves the issue in core.

Many thanks in advance,

-- 
Chris Williams
aka BinGOs
PGP ID 0x4658671F
http://www.gumbynet.org.uk
==========================

diff --git a/t/allfcns.t b/t/allfcns.t
index 0d04e94..c2de21c 100644
--- a/t/allfcns.t
+++ b/t/allfcns.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(
 	hmac_sha1	hmac_sha1_base64	hmac_sha1_hex
diff --git a/t/base64.t b/t/base64.t
index 284092d..6ebba00 100644
--- a/t/base64.t
+++ b/t/base64.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha1_base64 sha224_base64 sha256_base64
 	sha384_base64 sha512_base64);
diff --git a/t/bitbuf.t b/t/bitbuf.t
index a8b5472..4cf4032 100644
--- a/t/bitbuf.t
+++ b/t/bitbuf.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA;
 
diff --git a/t/bitorder.t b/t/bitorder.t
index 1419bb5..750f3b5 100644
--- a/t/bitorder.t
+++ b/t/bitorder.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA;
 
diff --git a/t/fips180-4.t b/t/fips180-4.t
index 15ad017..161a934 100644
--- a/t/fips180-4.t
+++ b/t/fips180-4.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha512_hex sha512224_hex sha512256_hex);
 
diff --git a/t/fips198.t b/t/fips198.t
index 6d5a2e0..da0c156 100644
--- a/t/fips198.t
+++ b/t/fips198.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(hmac_sha1_hex);
 
diff --git a/t/gg.t b/t/gg.t
index b78bb63..af0f5d6 100644
--- a/t/gg.t
+++ b/t/gg.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # Test against short bitwise vectors from Jim Gillogly and Francois Grieu
 
 use strict;
diff --git a/t/gglong.t b/t/gglong.t
index 6daac47..5551eef 100644
--- a/t/gglong.t
+++ b/t/gglong.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # Test against long bitwise vectors from Jim Gillogly and Francois Grieu
 
 use strict;
diff --git a/t/hmacsha.t b/t/hmacsha.t
index b1e8e34..a4e6f5c 100644
--- a/t/hmacsha.t
+++ b/t/hmacsha.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # HMAC-SHA-256 test vectors from draft-ietf-ipsec-ciph-sha-256-01.txt
 
 use strict;
diff --git a/t/inheritance.t b/t/inheritance.t
index 27c4312..5880e6e 100644
--- a/t/inheritance.t
+++ b/t/inheritance.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # Adapted from script by Mark Lawrence (ref. rt.cpan.org #94830)
 
 use strict;
diff --git a/t/ireland.t b/t/ireland.t
index edd650a..ef1ed33 100644
--- a/t/ireland.t
+++ b/t/ireland.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # David Ireland's test vector - SHA-256 digest of "a" x 536870912
 
 # Adapted from Julius Duque's original script (t/24-ireland.tmp)
diff --git a/t/methods.t b/t/methods.t
index ef956b1..1522f99 100644
--- a/t/methods.t
+++ b/t/methods.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use FileHandle;
 use Digest::SHA;
diff --git a/t/nistbit.t b/t/nistbit.t
index b035ed4..eef1271 100644
--- a/t/nistbit.t
+++ b/t/nistbit.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # Test against SHA-1 Sample Vectors from NIST
 
 use strict;
diff --git a/t/nistbyte.t b/t/nistbyte.t
index 722b920..1bdafa6 100644
--- a/t/nistbyte.t
+++ b/t/nistbyte.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # Test against SHA-1 Sample Vectors from NIST
 
 use strict;
diff --git a/t/pod.t b/t/pod.t
index 776ff0c..201480c 100644
--- a/t/pod.t
+++ b/t/pod.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 
 my $skip;
diff --git a/t/podcover.t b/t/podcover.t
index 321ef62..da6ffb2 100644
--- a/t/podcover.t
+++ b/t/podcover.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA;
 
diff --git a/t/rfc2202.t b/t/rfc2202.t
index acdf8c0..3006625 100644
--- a/t/rfc2202.t
+++ b/t/rfc2202.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(hmac_sha1_hex);
 
diff --git a/t/sha1.t b/t/sha1.t
index c2ab211..2c8313d 100644
--- a/t/sha1.t
+++ b/t/sha1.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha1_hex);
 
diff --git a/t/sha224.t b/t/sha224.t
index f083bd3..ab70b31 100644
--- a/t/sha224.t
+++ b/t/sha224.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha224_hex);
 
diff --git a/t/sha256.t b/t/sha256.t
index 5bcee35..72c1e8d 100644
--- a/t/sha256.t
+++ b/t/sha256.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha256_hex);
 
diff --git a/t/sha384.t b/t/sha384.t
index 16fefcf..2739449 100644
--- a/t/sha384.t
+++ b/t/sha384.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha384_hex);
 
diff --git a/t/sha512.t b/t/sha512.t
index bf662db..d417f66 100644
--- a/t/sha512.t
+++ b/t/sha512.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha512_hex);
 
diff --git a/t/state.t b/t/state.t
index c87e1f2..ff622ba 100644
--- a/t/state.t
+++ b/t/state.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha384_hex sha512_hex);
 
diff --git a/t/unicode.t b/t/unicode.t
index 4c87d83..9f0107a 100644
--- a/t/unicode.t
+++ b/t/unicode.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 use strict;
 use Digest::SHA qw(sha1_hex);
 
diff --git a/t/woodbury.t b/t/woodbury.t
index cdb49c7..9552700 100644
--- a/t/woodbury.t
+++ b/t/woodbury.t
@@ -1,10 +1,3 @@
-BEGIN {
-	if ($ENV{PERL_CORE}) {
-		chdir 't' if -d 't';
-		@INC = '../lib';
-	}
-}
-
 # Test Vectors for HMAC-SHA-256/384/512
 #
 # Vectors and initial script courtesy of Adam Woodbury, The MITRE Corporation




----- End forwarded message -----

-- 
Chris Williams
aka BinGOs
PGP ID 0x4658671F
http://www.gumbynet.org.uk
==========================



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About