mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
various tests: replace BEGIN/require/import by use
That is, turn
BEGIN {
require Foo;
Foo->import(...);
}
into
use Foo ...;
(Except for a few tests that did the `require Config; Config->import`
dance without actually using `%Config` anywhere, so I just deleted the
import code.)
This commit is contained in:
parent
650608f18d
commit
8b1b46cdfe
2
dist/I18N-Collate/t/I18N-Collate.t
vendored
2
dist/I18N-Collate/t/I18N-Collate.t
vendored
@ -6,8 +6,8 @@
|
||||
use strict;
|
||||
no warnings;
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if (!$::Config{d_setlocale} || $::Config{ccflags} =~ /\bD?NO_LOCALE\b/) {
|
||||
print "1..0\n";
|
||||
exit;
|
||||
|
||||
2
dist/IO/t/io_linenum.t
vendored
2
dist/IO/t/io_linenum.t
vendored
@ -7,8 +7,8 @@ my $File;
|
||||
|
||||
BEGIN {
|
||||
$File = __FILE__;
|
||||
require strict; strict->import();
|
||||
}
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 12;
|
||||
|
||||
|
||||
2
dist/Safe/t/safe1.t
vendored
2
dist/Safe/t/safe1.t
vendored
@ -1,7 +1,7 @@
|
||||
#!./perl -w
|
||||
$|=1;
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
2
dist/Safe/t/safe2.t
vendored
2
dist/Safe/t/safe2.t
vendored
@ -1,7 +1,7 @@
|
||||
#!./perl -w
|
||||
$|=1;
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
2
dist/Safe/t/safe3.t
vendored
2
dist/Safe/t/safe3.t
vendored
@ -1,7 +1,7 @@
|
||||
#!perl -w
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/
|
||||
&& $Config{'extensions'} !~ /\bPOSIX\b/
|
||||
&& $Config{'osname'} ne 'VMS')
|
||||
|
||||
3
dist/Safe/t/safeload.t
vendored
3
dist/Safe/t/safeload.t
vendored
@ -1,8 +1,7 @@
|
||||
#!perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config;
|
||||
Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
2
dist/Safe/t/saferegexp.t
vendored
2
dist/Safe/t/saferegexp.t
vendored
@ -1,7 +1,7 @@
|
||||
#!perl -w
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
3
dist/Safe/t/safesecurity.t
vendored
3
dist/Safe/t/safesecurity.t
vendored
@ -1,8 +1,7 @@
|
||||
#!perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config;
|
||||
Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
3
dist/Safe/t/safesig.t
vendored
3
dist/Safe/t/safesig.t
vendored
@ -1,8 +1,7 @@
|
||||
#!perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config;
|
||||
Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
2
dist/Safe/t/safesort.t
vendored
2
dist/Safe/t/safesort.t
vendored
@ -1,7 +1,7 @@
|
||||
#!perl -w
|
||||
$|=1;
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
3
dist/Safe/t/safeuniversal.t
vendored
3
dist/Safe/t/safeuniversal.t
vendored
@ -1,8 +1,7 @@
|
||||
#!perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config;
|
||||
Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
2
dist/Safe/t/safeutf8.t
vendored
2
dist/Safe/t/safeutf8.t
vendored
@ -1,7 +1,7 @@
|
||||
#!perl -w
|
||||
$|=1;
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
2
dist/Safe/t/safewrap.t
vendored
2
dist/Safe/t/safewrap.t
vendored
@ -1,8 +1,8 @@
|
||||
#!perl -w
|
||||
|
||||
$|=1;
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!./perl -T
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bDevel\/Peek\b/) {
|
||||
print "1..0 # Skip: Devel::Peek was not built\n";
|
||||
exit 0;
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
# stdio: open(), tell(), seek(), print(), read() is tested in t/op/lfs.t.
|
||||
# If you modify/add tests here, remember to update also t/op/lfs.t.
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
# Don't bother if there are no quad offsets.
|
||||
if ($Config{lseeksize} < 8) {
|
||||
print "1..0 # Skip: no 64-bit file offsets\n";
|
||||
exit(0);
|
||||
}
|
||||
require Fcntl; Fcntl->import(qw(/^O_/ /^SEEK_/));
|
||||
}
|
||||
use Fcntl qw(/^O_/ /^SEEK_/);
|
||||
|
||||
use strict;
|
||||
use File::Temp 'tempfile';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!./perl -w
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if (!$Config{'d_fork'}
|
||||
# open2/3 supported on win32
|
||||
&& $^O ne 'MSWin32')
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
$|=1;
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!./perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
# the Perl one. So we run the tests in a separate "fresh_perl" process
|
||||
# with the correct LC_CTYPE set in the environment.
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($^O ne 'VMS' and $Config{'extensions'} !~ /\bPOSIX\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!./perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($^O ne 'VMS' and $Config{'extensions'} !~ /\bPOSIX\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!./perl -Tw
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($^O ne 'VMS' and $Config{'extensions'} !~ /\bPOSIX\b/) {
|
||||
print "1..0\n";
|
||||
exit 0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!./perl
|
||||
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bSys\/Hostname\b/) {
|
||||
print "1..0 # Skip: Sys::Hostname was not built\n";
|
||||
exit 0;
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
# DAPM Dec 2005
|
||||
|
||||
my $threads;
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
$threads = $Config{'useithreads'};
|
||||
# must 'use threads' before 'use Test::More'
|
||||
eval 'use threads' if $threads;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use Config;
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bXS\/Typemap\b/) {
|
||||
print "1..0 # Skip: XS::Typemap was not built\n";
|
||||
exit 0;
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require Config; Config->import;
|
||||
require Test::More; Test::More->import;
|
||||
plan(tests, 12);
|
||||
}
|
||||
use Config;
|
||||
use Test::More;
|
||||
plan(tests, 12);
|
||||
|
||||
require AnyDBM_File;
|
||||
use Fcntl;
|
||||
|
||||
@ -6,9 +6,9 @@ BEGIN {
|
||||
}
|
||||
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
BEGIN {
|
||||
require Config; Config->import;
|
||||
if ($Config{'extensions'} !~ /\bSocket\b/ &&
|
||||
!(($^O eq 'VMS') && $Config{d_socket}))
|
||||
{
|
||||
@ -19,8 +19,6 @@ BEGIN {
|
||||
}
|
||||
}
|
||||
|
||||
use Test::More;
|
||||
|
||||
BEGIN { use_ok 'Net::hostent' }
|
||||
|
||||
# Remind me to add this to Test::More.
|
||||
|
||||
@ -54,8 +54,8 @@ BEGIN {
|
||||
exit;
|
||||
}
|
||||
$| = 1;
|
||||
require Config; Config->import;
|
||||
}
|
||||
use Config;
|
||||
|
||||
use feature 'fc';
|
||||
my @langinfo;
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require Config; Config->import;
|
||||
require './test.pl';
|
||||
require './charset_tools.pl';
|
||||
}
|
||||
use Config;
|
||||
|
||||
plan 11;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ BEGIN {
|
||||
set_up_inc( qw(. ../lib) );
|
||||
}
|
||||
|
||||
require Config; Config->import;
|
||||
use Config;
|
||||
plan(tests => 1);
|
||||
|
||||
SKIP: {
|
||||
|
||||
@ -4,8 +4,8 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib');
|
||||
require Config; Config->import;
|
||||
}
|
||||
use Config;
|
||||
if (!$Config{'d_fork'}) {
|
||||
skip_all("fork required to pipe");
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ BEGIN {
|
||||
@INC = '../lib' if -d '../lib' && -d '../ext';
|
||||
|
||||
require "./test.pl";
|
||||
require Config; Config->import;
|
||||
}
|
||||
use Config;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -5,11 +5,10 @@ BEGIN {
|
||||
@INC = '../lib';
|
||||
require './test.pl';
|
||||
}
|
||||
use Config;
|
||||
|
||||
plan( tests => 1);
|
||||
|
||||
require Config; Config->import;
|
||||
|
||||
if (($Config{'extensions'} !~ /\bFcntl\b/) ){
|
||||
BAIL_OUT("Perl configured without Fcntl module");
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib');
|
||||
require Config; Config->import;
|
||||
skip_all_without_unicode_tables();
|
||||
require './charset_tools.pl';
|
||||
require './loc_tools.pl'; # Contains find_utf8_ctype_locale()
|
||||
|
||||
@ -4,9 +4,9 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require "./test.pl";
|
||||
set_up_inc( qw(../lib .) );
|
||||
require Config; Config->import;
|
||||
require "./loc_tools.pl";
|
||||
}
|
||||
use Config;
|
||||
|
||||
plan tests => 60;
|
||||
|
||||
|
||||
@ -16,9 +16,9 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib','.','../ext/re');
|
||||
require Config; Config->import;
|
||||
skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader;
|
||||
}
|
||||
use Config;
|
||||
|
||||
# An array is used instead of a hash, so that the tests are carried out in the
|
||||
# order given by this file. Even-numbered indices are the regexes to compile.
|
||||
|
||||
@ -12,7 +12,6 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib');
|
||||
require Config; Config->import;
|
||||
skip_all_if_miniperl("no dynamic loading on miniperl, no Encode nor POSIX");
|
||||
if ($^O eq 'dec_osf') {
|
||||
skip_all("$^O cannot handle this test");
|
||||
|
||||
@ -18,10 +18,10 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib', '.', '../ext/re');
|
||||
require Config; Config->import;
|
||||
require './charset_tools.pl';
|
||||
require './loc_tools.pl';
|
||||
}
|
||||
use Config;
|
||||
|
||||
skip_all_without_unicode_tables();
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib','.','../ext/re');
|
||||
require Config; Config->import;
|
||||
}
|
||||
use Config;
|
||||
|
||||
skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader;
|
||||
skip_all_without_unicode_tables();
|
||||
|
||||
@ -15,7 +15,6 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib', '.', '../ext/re');
|
||||
require Config; Config->import;
|
||||
}
|
||||
|
||||
skip_all_without_config('useithreads');
|
||||
|
||||
@ -4,12 +4,11 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc('../lib');
|
||||
require Config; Config->import;
|
||||
require constant;
|
||||
constant->import(constcow => *Config::{NAME});
|
||||
require './charset_tools.pl';
|
||||
require './loc_tools.pl';
|
||||
}
|
||||
use Config;
|
||||
use constant constcow => *Config::{NAME};
|
||||
|
||||
plan(tests => 281);
|
||||
|
||||
|
||||
@ -45,9 +45,8 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require './test.pl';
|
||||
require Config;
|
||||
Config->import;
|
||||
}
|
||||
use Config;
|
||||
|
||||
skip_all_without_config('d_fork');
|
||||
skip_all("NO_PERL_HASH_ENV or NO_PERL_HASH_SEED_DEBUG set")
|
||||
|
||||
@ -4,9 +4,8 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require './test.pl';
|
||||
require Config;
|
||||
Config->import;
|
||||
}
|
||||
use Config;
|
||||
|
||||
skip_all_without_config('d_fork');
|
||||
skip_all("This perl is built with NO_PERL_RAND_SEED")
|
||||
|
||||
@ -3,10 +3,8 @@
|
||||
BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require Config;
|
||||
Config->import;
|
||||
|
||||
}
|
||||
use Config;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
@ -7,11 +7,10 @@
|
||||
BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require Config; Config->import;
|
||||
require "./test.pl";
|
||||
require "./loc_tools.pl";
|
||||
}
|
||||
|
||||
BEGIN { require "./test.pl"; require "./loc_tools.pl"; }
|
||||
|
||||
use Config;
|
||||
|
||||
# due to a bug in VMS's piping which makes it impossible for runperl()
|
||||
|
||||
@ -5,8 +5,8 @@ BEGIN {
|
||||
set_up_inc('../lib', '.', '../ext/re');
|
||||
require './charset_tools.pl';
|
||||
require './loc_tools.pl';
|
||||
require Config; Config->import;
|
||||
}
|
||||
use Config;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -10,7 +10,6 @@ BEGIN {
|
||||
set_up_inc('../lib');
|
||||
skip_all_without_unicode_tables();
|
||||
skip_all_if_miniperl("miniperl, no Unicode::Normalize");
|
||||
require Config; Config->import;
|
||||
require './charset_tools.pl';
|
||||
require './loc_tools.pl'; # Contains find_utf8_ctype_locale()
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
require './test.pl';
|
||||
set_up_inc( '../lib' );
|
||||
require Config; Config->import;
|
||||
require './charset_tools.pl';
|
||||
require './loc_tools.pl';
|
||||
}
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
BEGIN {
|
||||
chdir 't' if -d 't';
|
||||
@INC = '../lib';
|
||||
require Config; Config->import;
|
||||
require File::Temp; File::Temp->import(qw/:POSIX/);
|
||||
|
||||
require Win32;
|
||||
($::os_id, $::os_major) = ( Win32::GetOSVersion() )[ 4, 1 ];
|
||||
@ -22,6 +20,8 @@ BEGIN {
|
||||
|
||||
require './test.pl';
|
||||
}
|
||||
use Config;
|
||||
use File::Temp qw/:POSIX/;
|
||||
|
||||
skip_all "requires compilation with PERL_IMPLICIT_SYS"
|
||||
unless $Config{ccflags} =~/(?:\A|\s)-DPERL_IMPLICIT_SYS\b/;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user