File: 12-export-base.t

package info (click to toggle)
libfindbin-libs-perl 4.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704 kB
  • sloc: perl: 1,323; sh: 38; makefile: 7
file content (81 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download
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
#!/usr/bin/perl

package Testophile;

use v5.8;

#no warnings;    # avoid extraneous nastygrams about qw

use Symbol;
use Test::More;

$\ = "\n";
$, = "\n\t";

# export @lib after looking for */lib
# export @found after looking for */blib
# export @binz after looking for */bin, override the 
# "ignore" to search /bin, /usr/bin.
#
# eval necessary for crippled O/S w/ missing/broken symlinks.

BEGIN
{
    eval
    {
        symlink qw( /nonexistant/path/to/something ./dead-link )
    }
}

END
{
    eval
    {
        unlink './dead-link';
    }
}

my %testz
= qw
(
    lib         1
    found       1
    missing     0
    dead-link   0
);


sub check_var
{
    my $name    = shift;
    my $dest    = qualify        $name;
    my $ref     = qualify_to_ref $dest;

    eval
    {
        $testz{ $name }
        ? ok   @{ *$ref }, "Non-empty: \@$dest"
        : ok ! @{ *$ref }, "Empty: \@$dest"
        ;

        1
    }
    or fail "Not installed: '$name', $@";
};

# libs & found should be populated.
# missing and dead should be empty.

my $madness = 'FindBin::libs';

use_ok $madness => qw( export );

$madness->import( qw( export=found      base=t                      ) );
$madness->import( qw( export=missing    base=non-existant-directory ) );
$madness->import( qw( export=dead       base=dead-link              ) );

check_var $_  for keys %testz;

done_testing;

exit 0;