This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Simplify the startup skip logic of tests in t/uni.
authorNicholas Clark <nick@ccl4.org>
Mon, 7 Mar 2011 16:31:05 +0000 (16:31 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 7 Mar 2011 16:31:05 +0000 (16:31 +0000)
Use the various skip_all*() functions in test.pl to express the desired intent.

t/uni/chomp.t
t/uni/chr.t
t/uni/greek.t
t/uni/latin2.t
t/uni/tr_7jis.t
t/uni/tr_eucjp.t
t/uni/tr_sjis.t
t/uni/tr_utf8.t
t/uni/write.t

index 6aef50c..1292fb6 100644 (file)
@@ -1,25 +1,11 @@
 #!./perl -w
 
 BEGIN {
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 use strict;
index 8d7924f..227dc52 100644 (file)
@@ -1,26 +1,11 @@
 #!./perl -w
 
 BEGIN {
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
-
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 use strict;
index a8102f3..a1ca3c4 100644 (file)
@@ -1,27 +1,11 @@
+#!./perl -w
+
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir 't';
-        @INC = '../lib';
-    }
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 plan tests => 72;
index 08928b6..344d1a8 100644 (file)
@@ -1,27 +1,11 @@
+#!./perl -w
+
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir 't';
-        @INC = '../lib';
-    }
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 plan tests => 94;
index 46f80a1..90f3431 100644 (file)
@@ -5,25 +5,11 @@
 # -- dankogai
 
 BEGIN {
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 use strict;
index 6b2ca2b..352684d 100644 (file)
@@ -4,25 +4,11 @@
 # -- dankogai
 
 BEGIN {
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 use strict;
index d71c4ba..fca9d6c 100644 (file)
@@ -4,25 +4,11 @@
 # -- dankogai
 
 BEGIN {
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 use strict;
index 8e697ce..aa8f439 100644 (file)
@@ -5,29 +5,11 @@
 # -- dankogai
 
 BEGIN {
-    if ($ENV{'PERL_CORE'}){
-        chdir 't';
-        @INC = '../lib';
-    }
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bEncode\b/) {
-      print "1..0 # Skip: Encode was not built\n";
-      exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC\n";
-        exit 0;
-    }
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if ($ENV{PERL_CORE_MINITEST}) {
-        print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
-        exit 0;
-    }
-    $| = 1;
     require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no Encode");
+    skip_all("EBCDIC") if $::IS_EBCDIC;
+    skip_all_without_perlio();
+    skip_all_without_extension('Encode');
 }
 
 use strict;
index 136be67..c60065d 100644 (file)
@@ -2,17 +2,9 @@
 use strict;
 
 BEGIN {
-    chdir 't' if -d 't';
-    @INC = qw(../lib .);
-    require "test.pl";
-    unless (PerlIO::Layer->find('perlio')){
-        print "1..0 # Skip: PerlIO required\n";
-        exit 0;
-    }
-    if (ord("A") == 193) {
-        print "1..0 # Skip: EBCDIC porting needed\n";
-        exit 0;
-    }
+    require './test.pl';
+    skip_all("EBCDIC porting needed") if $::IS_EBCDIC;
+    skip_all_without_perlio();
 }
 
 plan tests => 6;