Move if from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / ext / IO-Compress / t / 000prereq.t
1 BEGIN {
2     if ($ENV{PERL_CORE}) {
3         chdir 't' if -d 't';
4         @INC = ("../lib", "lib/compress");
5     }
6 }
7
8 use lib qw(t t/compress);
9 use strict ;
10 use warnings ;
11
12 use Test::More ;
13
14 sub gotScalarUtilXS
15 {
16     eval ' use Scalar::Util "dualvar" ';
17     return $@ ? 0 : 1 ;
18 }
19
20 BEGIN
21 {
22     # use Test::NoWarnings, if available
23     my $extra = 0 ;
24     $extra = 1
25         if eval { require Test::NoWarnings ;  import Test::NoWarnings; 1 };
26
27
28     my $VERSION = '2.021';
29     my @NAMES = qw(
30                         Compress::Raw::Bzip2
31                         Compress::Raw::Zlib
32
33                         Compress::Zlib
34
35             IO::Compress::Adapter::Bzip2
36             IO::Compress::Adapter::Deflate
37             IO::Compress::Adapter::Identity
38             IO::Compress::Base::Common
39             IO::Compress::Base
40             IO::Compress::Bzip2
41             IO::Compress::Deflate
42             IO::Compress::Gzip::Constants
43             IO::Compress::Gzip
44             IO::Compress::RawDeflate
45             IO::Compress::Zip::Constants
46             IO::Compress::Zip
47             IO::Compress::Zlib::Constants
48             IO::Compress::Zlib::Extra
49             IO::Uncompress::Adapter::Bunzip2
50             IO::Uncompress::Adapter::Identity
51             IO::Uncompress::Adapter::Inflate
52             IO::Uncompress::AnyInflate
53             IO::Uncompress::AnyUncompress
54             IO::Uncompress::Base
55             IO::Uncompress::Bunzip2
56             IO::Uncompress::Gunzip
57             IO::Uncompress::Inflate
58             IO::Uncompress::RawInflate
59             IO::Uncompress::Unzip
60
61                         );
62
63     my @OPT = qw(
64                         
65                         );
66
67     plan tests => 2 + @NAMES + @OPT + $extra ;
68
69     foreach my $name (@NAMES)
70     {
71         use_ok($name, $VERSION);
72     }
73
74
75     foreach my $name (@OPT)
76     {
77         eval " require $name " ;
78         if ($@)
79         {
80             ok 1, "$name not available" 
81         }
82         else  
83         {
84             my $ver = eval("\$${name}::VERSION");
85             is $ver, $VERSION, "$name version should be $VERSION" 
86                 or diag "$name version is $ver, need $VERSION" ;
87         }         
88     }
89
90     use_ok('Scalar::Util') ;
91
92 }
93
94 ok gotScalarUtilXS(), "Got XS Version of Scalar::Util"
95     or diag <<EOM;
96 You don't have the XS version of Scalar::Util
97 EOM
98