This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Clean up 1_compile.t; move tests to more consistent
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 7 Sep 2001 20:26:29 +0000 (20:26 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 7 Sep 2001 20:26:29 +0000 (20:26 +0000)
places (t/ subdirectories); add integer.t (much of
the pragma is tested elsewhere but there is no one
centralized place)

p4raw-id: //depot/perl@11940

12 files changed:
MANIFEST
ext/Fcntl/t/fcntl.t [moved from ext/Fcntl/Fcntl.t with 100% similarity]
ext/Fcntl/t/syslfs.t [moved from ext/Fcntl/syslfs.t with 100% similarity]
ext/POSIX/t/posix.t [moved from ext/POSIX/POSIX.t with 100% similarity, mode: 0644]
ext/POSIX/t/sigaction.t [moved from ext/POSIX/sigaction.t with 100% similarity]
lib/Env/t/array.t [moved from lib/Env/array.t with 100% similarity, mode: 0644]
lib/Env/t/env.t [moved from lib/Env/env.t with 100% similarity, mode: 0644]
lib/File/Find/t/find.t [moved from lib/File/Find/find.t with 100% similarity, mode: 0644]
lib/File/Find/t/taint.t [moved from lib/File/Find/taint.t with 100% similarity]
lib/integer.t [new file with mode: 0644]
t/lib/1_compile.t
t/op/lfs.t

index 0cd8c0e..b4d2c72 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -300,10 +300,10 @@ ext/Errno/Errno.t See if Errno works
 ext/Errno/Errno_pm.PL  Errno perl module create script
 ext/Errno/Makefile.PL  Errno extension makefile writer
 ext/Fcntl/Fcntl.pm     Fcntl extension Perl module
-ext/Fcntl/Fcntl.t      See if Fcntl works
 ext/Fcntl/Fcntl.xs     Fcntl extension external subroutines
 ext/Fcntl/Makefile.PL  Fcntl extension makefile writer
-ext/Fcntl/syslfs.t     See if large files work for sysio
+ext/Fcntl/t/fcntl.t    See if Fcntl works
+ext/Fcntl/t/syslfs.t   See if large files work for sysio
 ext/File/Glob/bsd_glob.c       File::Glob extension run time code
 ext/File/Glob/bsd_glob.h       File::Glob extension header file
 ext/File/Glob/Changes          File::Glob extension changelog
@@ -456,9 +456,9 @@ ext/POSIX/hints/uts.pl              Hint for POSIX for named architecture
 ext/POSIX/Makefile.PL          POSIX extension makefile writer
 ext/POSIX/POSIX.pm             POSIX extension Perl module
 ext/POSIX/POSIX.pod            POSIX extension documentation
-ext/POSIX/POSIX.t              See if POSIX works
 ext/POSIX/POSIX.xs             POSIX extension external subroutines
-ext/POSIX/sigaction.t          See if POSIX::sigaction works
+ext/POSIX/t/posix.t            See if POSIX works
+ext/POSIX/t/sigaction.t                See if POSIX::sigaction works
 ext/POSIX/typemap              POSIX extension interface types
 ext/re/hints/mpeix.pl          Hints for re for named architecture
 ext/re/Makefile.PL             re extension makefile writer
@@ -841,8 +841,8 @@ lib/dumpvar.pl                      A variable dumper
 lib/English.pm                 Readable aliases for short variables
 lib/English.t                  See if English works
 lib/Env.pm                     Map environment into ordinary variables
-lib/Env/array.t                        See if Env works
-lib/Env/env.t                  See if Env works for arrays
+lib/Env/t/array.t              See if Env works for arrays
+lib/Env/t/env.t                        See if Env works
 lib/exceptions.pl              catch and throw routines
 lib/Exporter.pm                        Exporter base class
 lib/Exporter.t                 See if Exporter works
@@ -886,8 +886,8 @@ lib/File/Copy.t                     See if File::Copy works
 lib/File/DosGlob.pm            Win32 DOS-globbing module
 lib/File/DosGlob.t             See if File::DosGlob works
 lib/File/Find.pm               Routines to do a find
-lib/File/Find/find.t           See if File::Find works
-lib/File/Find/taint.t          See if File::Find works with taint
+lib/File/Find/t/find.t         See if File::Find works
+lib/File/Find/t/taint.t                See if File::Find works with taint
 lib/File/Path.pm               Do things like `mkdir -p' and `rm -r'
 lib/File/Path.t                        See if File::Path works
 lib/File/Spec.pm               portable operations on file names
@@ -946,6 +946,7 @@ lib/I18N/LangTags/README    I18N::LangTags
 lib/I18N/LangTags/test.pl      See if I18N::LangTags works
 lib/importenv.pl               Perl routine to get environment into variables
 lib/integer.pm                 For "use integer"
+lib/integer.t                  For "use integer" testing
 lib/IPC/Open2.pm               Open a two-ended pipe
 lib/IPC/Open2.t                        See if IPC::Open2 works
 lib/IPC/Open3.pm               Open a three-ended pipe!
similarity index 100%
rename from ext/Fcntl/Fcntl.t
rename to ext/Fcntl/t/fcntl.t
similarity index 100%
rename from ext/Fcntl/syslfs.t
rename to ext/Fcntl/t/syslfs.t
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from ext/POSIX/POSIX.t
rename to ext/POSIX/t/posix.t
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from lib/Env/array.t
rename to lib/Env/t/array.t
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from lib/Env/env.t
rename to lib/Env/t/env.t
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from lib/File/Find/find.t
rename to lib/File/Find/t/find.t
diff --git a/lib/integer.t b/lib/integer.t
new file mode 100644 (file)
index 0000000..4184747
--- /dev/null
@@ -0,0 +1,46 @@
+use integer;
+
+use Test::More tests => 11;
+use Config;
+
+my $x = 4.5;
+my $y = 5.6;
+my $z;
+
+$z = $x + $y;
+is($z, 9, "plus");
+
+$z = $x - $y;
+is($z, -1, "minus");
+
+$z = $x * $y;
+is($z, 20, "times");
+
+$z = $x / $y;
+is($z, 0, "divide");
+
+$z = $x / $y;
+is($z, 0, "modulo");
+
+is($x, 4.5, "scalar still floating point");
+isnt(sqrt($x), 2, "functions still floating point");
+isnt($x ** .5, 2, "power still floating point");
+
+is(++$x, 5.5, "++ still floating point");
+SKIP: {
+    my $ivsize = $Config{ivsize};
+    skip "ivsize == $ivsize", 2 unless $ivsize == 4 || $ivsize == 8;
+
+    if ($ivsize == 4) {
+       $z = 2**31 - 1;
+       is($z + 1, -2147483648, "left shift");
+    } elsif ($ivsize == 8) {
+       $z = 2**63 - 1;
+       is($z + 1, -9223372036854775808, "left shift");
+    }
+}
+
+is(~0, -1, "unsigned");
index 625263a..a7871fc 100644 (file)
@@ -10,6 +10,7 @@ use warnings;
 use Config;
 
 my %Core_Modules;
+my %Test;
 
 unless (open(MANIFEST, "MANIFEST")) {
     die "$0: failed to open 'MANIFEST': $!\n";
@@ -20,10 +21,20 @@ sub add_by_name {
 }
 
 while (<MANIFEST>) {
-    next unless m!^lib/(\S+?)\.pm!;
-    my $module = $1;
-    $module =~ s!/!::!g;
-    add_by_name($module);
+    if (m!^(lib)/(\S+?)\.pm\s!) {
+       # Collecting modules names from under ext/ would be
+       # rather painful since the mapping from filenames
+       # to module names is not 100%.
+       my ($dir, $module) = ($1, $2);
+       $module =~ s!/!::!g;
+       add_by_name($module);
+    } elsif (m!^(lib|ext)/(\S+?)(?:\.t|/test.pl)\s!) {
+       my ($dir, $test) = ($1, $2);
+       $test =~ s!(\w+)/\1$!$1! if $dir eq 'ext';
+       $test =~ s!/t/[^/]+$!!;
+       $test =~ s!/!::!g;
+       $Test{$test}++;
+    }
 }
 
 close(MANIFEST);
@@ -83,8 +94,12 @@ delete_by_prefix('unicode::');
 
 # Delete all modules which have their own tests.
 # This makes this test a lot faster.
+foreach my $mod (sort keys %Test) {
+    delete_by_name($mod);
+}
 foreach my $mod (<DATA>) {
     chomp $mod;
+    print "### $mod\n" if exists $Test{$mod};
     delete_by_name($mod);
 }
 
@@ -115,16 +130,7 @@ sub compile_module {
 # Add here modules that have their own test scripts and therefore
 # need not be test-compiled by 1_compile.t.
 __DATA__
-AnyDBM_File
-Attribute::Handlers
-AutoLoader
-B
-B::Debug
-B::Deparse
 B::ShowLex
-B::Stash
-Benchmark
-CGI
 CGI::Apache
 CGI::Carp
 CGI::Cookie
@@ -132,55 +138,15 @@ CGI::Form
 CGI::Pretty
 CGI::Switch
 CGI::Util
-Carp
 Carp::Heavy
-Class::ISA
-Class::Struct
-CPAN
-Cwd
-DB_File
-Data::Dumper
 Devel::DProf
-Devel::Peek
-Devel::SelfStubber
-Digest
-Digest::MD5
-DirHandle
 Dumpvalue
-Encode
-English
-Env
-Errno
-Exporter
 Exporter::Heavy
 ExtUtils::Constant
 ExtUtils::MakeMaker
-Fatal
-Fcntl
-File::Basename
-File::CheckTree
-File::Compare
-File::Copy
-File::DosGlob
-File::Find
-File::Glob
-File::Path
-File::Spec
-File::Spec::Functions
-File::Temp
-File::stat
-FileCache
-FileHandle
-Filter::Simple
 Filter::Util::Call
-FindBin
 GDBM_File
-Getopt::Long
-Getopt::Std
-I18N::Langinfo
-I18N::LangTags
 I18N::LangTags::List
-I18N::Collate
 IO::Dir
 IO::File
 IO::Handle
@@ -191,24 +157,13 @@ IO::Select
 IO::Socket
 IO::Socket::INET
 IO::Socket::UNIX
-IPC::Open2
-IPC::Open3
-IPC::SysV
-Lingua::KO::Hangul::Util
-List::Util
 Locale::Constants
 Locale::Country
 Locale::Currency
 Locale::Language
-Locale::Maketext
-MIME::Base64
 MIME::QuotedPrint
 Math::BigFloat
-Math::BigInt
 Math::BigInt::Calc
-Math::Complex
-Math::Trig
-Memoize
 Memoize::AnyDBM_File
 Memoize::Expire
 Memoize::ExpireFile
@@ -217,15 +172,7 @@ Memoize::NDBM_File
 Memoize::SDBM_File
 Memoize::Storable
 NDBM_File
-NEXT
-Net::hostent
-Net::netent
-Net::protoent
-Net::servent
 ODBM_File
-Opcode
-PerlIO
-POSIX
 Pod::Checker
 Pod::Find
 Pod::Text
@@ -233,64 +180,20 @@ Pod::Usage
 SDBM_File
 Safe
 Scalar::Util
-Search::Dict
-SelectSaver
-SelfLoader
-Shell
-Socket
-Storable
-Switch
-Symbol
-Sys::Hostname
 Sys::Syslog
-Term::ANSIColor
-Test
-Test::Harness
 Test::More
-Test::Simple
 Test::ParseWords
-Text::Abbrev
-Text::Balanced
-Text::ParseWords
-Text::Soundex
 Text::Tabs
 Text::Wrap
 Thread
 Tie::Array
 Tie::Handle
 Tie::Hash
-Tie::RefHash
 Tie::Scalar
-Tie::SubstrHash
-Time::HiRes
-Time::Local
-Time::gmtime
-Time::localtime
 Time::tm
-Unicode::Collate
-Unicode::Normalize
-Unicode::UCD
 UNIVERSAL
-User::grent
-User::pwent
-XS::Typemap
 attributes
-attrs
-autouse
 base
 bytes
-charnames
-constant
-diagnostics
-fields
-integer
-less
-locale
 ops
-overload
-strict
-subs
-utf8
-vars
-warnings
 warnings::register
index 2652555..8be24f4 100644 (file)
@@ -1,6 +1,6 @@
 # NOTE: this file tests how large files (>2GB) work with perlio (stdio/sfio).
 # sysopen(), sysseek(), syswrite(), sysread() are tested in t/lib/syslfs.t.
-# If you modify/add tests here, remember to update also t/lib/syslfs.t.
+# If you modify/add tests here, remember to update also ext/Fcntl/t/syslfs.t.
 
 BEGIN {
        chdir 't' if -d 't';