summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/cpan/IO-Compress/t/000prereq.t
blob: c3395464c49bddc6bf2077636acec7e436b9be81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
BEGIN {
    if ($ENV{PERL_CORE}) {
        chdir 't' if -d 't';
        @INC = ("../lib", "lib/compress");
    }
}

use lib qw(t t/compress);
use strict ;
use warnings ;

use Test::More ;

sub gotScalarUtilXS
{
    eval ' use Scalar::Util "dualvar" ';
    return $@ ? 0 : 1 ;
}

BEGIN
{
    # use Test::NoWarnings, if available
    my $extra = 0 ;
    $extra = 1
        if eval { require Test::NoWarnings ;  import Test::NoWarnings; 1 };


    my $VERSION = '2.084';
    my @NAMES = qw(
			Compress::Raw::Bzip2
			Compress::Raw::Zlib

			Compress::Zlib

            IO::Compress::Adapter::Bzip2
            IO::Compress::Adapter::Deflate
            IO::Compress::Adapter::Identity
            IO::Compress::Base::Common
            IO::Compress::Base
            IO::Compress::Bzip2
            IO::Compress::Deflate
            IO::Compress::Gzip::Constants
            IO::Compress::Gzip
            IO::Compress::RawDeflate
            IO::Compress::Zip::Constants
            IO::Compress::Zip
            IO::Compress::Zlib::Constants
            IO::Compress::Zlib::Extra
            IO::Uncompress::Adapter::Bunzip2
            IO::Uncompress::Adapter::Identity
            IO::Uncompress::Adapter::Inflate
            IO::Uncompress::AnyInflate
            IO::Uncompress::AnyUncompress
            IO::Uncompress::Base
            IO::Uncompress::Bunzip2
            IO::Uncompress::Gunzip
            IO::Uncompress::Inflate
            IO::Uncompress::RawInflate
            IO::Uncompress::Unzip

			);

    my @OPT = qw(
			
			);

    plan tests => 1 + 2 + @NAMES + @OPT + $extra ;

    foreach my $name (@NAMES)
    {
        use_ok($name, $VERSION);
    }


    foreach my $name (@OPT)
    {
        eval " require $name " ;
        if ($@)
        {
            ok 1, "$name not available" 
        }
        else  
        {
            my $ver = eval("\$${name}::VERSION");
            is $ver, $VERSION, "$name version should be $VERSION" 
                or diag "$name version is $ver, need $VERSION" ;
        }         
    }

    # need zlib 1.2.0 or better
    
    cmp_ok Compress::Raw::Zlib::ZLIB_VERNUM(), ">=", 0x1200
        or diag "IO::Compress needs zlib 1.2.0 or better, you have " . Compress::Raw::Zlib::zlib_version(); 
    
    use_ok('Scalar::Util') ;

}

ok gotScalarUtilXS(), "Got XS Version of Scalar::Util"
    or diag <<EOM;
You don't have the XS version of Scalar::Util
EOM