Debian lenny version packages
[pkg-perl] / deb-src / libnet-ssleay-perl / libnet-ssleay-perl-1.35 / t / local / 20_autoload.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use Net::SSLeay;
7
8 eval "use Test::Exception;";
9 plan skip_all => 'Some tests need Test::Exception' if $@;
10
11 plan tests => 6;
12
13 {
14     my $const;
15     lives_ok(sub {
16             $const = Net::SSLeay::OP_NO_TLSv1();
17     }, 'some random constant exists');
18
19     ok( defined $const, '  and has a defined value' );
20 }
21
22 lives_ok(sub {
23         Net::SSLeay::make_form( foo => 'bar' );
24 }, 'some random function gets autoloaded');
25
26
27 throws_ok(sub {
28         Net::SSLeay::TXT_RC2_128_CBC_EXPORT40_WITH_MD5();
29 }, qr/^Can't locate .*?TXT_RC2_128\.al/, 'disabled constant doesn\'t exist');
30
31 throws_ok(sub {
32         Net::SSLeay::123x();
33 }, qr/^Can't locate .*?123x\.al/, 'invalid constant doesn\'t exist' );
34
35 throws_ok(sub {
36         Net::SSLeay::_TEST_INVALID_CONSTANT();
37 }, qr/^Your vendor has not defined SSLeay macro _TEST_INVALID_CONSTANT /,
38 'raises an appropriate error when an openssl macro isn\'t defined');