1#!perl
2#===============================================================================
3#
4# t/01_imports_04.t
5#
6# DESCRIPTION
7#   Test script to check import options.
8#
9# COPYRIGHT
10#   Copyright (C) 2014 Steve Hay.  All rights reserved.
11#
12# LICENCE
13#   This script is free software; you can redistribute it and/or modify it under
14#   the same terms as Perl itself, i.e. under the terms of either the GNU
15#   General Public License or the Artistic License, as specified in the LICENCE
16#   file.
17#
18#===============================================================================
19
20use 5.008001;
21
22use strict;
23use warnings;
24
25use Cwd qw(abs_path);
26use File::Spec::Functions qw(canonpath catdir catfile updir);
27use FindBin qw($Bin);
28use Test::More;
29
30#===============================================================================
31# INITIALIZATION
32#===============================================================================
33
34BEGIN {
35    my $top_dir = canonpath(abs_path(catdir($Bin, updir())));
36    my $lib_dir = catfile($top_dir, 'blib', 'lib', 'Filter', 'Crypto');
37
38    if (-f catfile($lib_dir, 'CryptFile.pm')) {
39        plan tests => 7;
40        use_ok('Filter::Crypto::CryptFile', qw(CRYPT_MODE_AUTO));
41    }
42    else {
43        plan skip_all => 'CryptFile component not built';
44    }
45}
46
47#===============================================================================
48# MAIN PROGRAM
49#===============================================================================
50
51MAIN: {
52    ok(!defined &main::crypt_file, 'crypt_file is not imported');
53    ok( eval { CRYPT_MODE_AUTO(); 1 }, 'CRYPT_MODE_AUTO is imported');
54    ok(!eval { CRYPT_MODE_DECRYPT(); 1 }, 'CRYPT_MODE_DECRYPT is not imported');
55    ok(!eval { CRYPT_MODE_ENCRYPT(); 1 }, 'CRYPT_MODE_ENCRYPT is not imported');
56    ok(!eval { CRYPT_MODE_DECRYPTED(); 1 }, 'CRYPT_MODE_DECRYPTED is not imported');
57    ok(!eval { CRYPT_MODE_ENCRYPTED(); 1 }, 'CRYPT_MODE_ENCRYPTED is not imported');
58}
59
60#===============================================================================
61