line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Env; |
2
|
2
|
|
|
2
|
|
70363
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
12
|
use vars qw(@EXPORT $VERSION); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
181
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
15
|
use Exporter qw(import); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
100
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
@EXPORT = qw(env_ok); |
9
|
|
|
|
|
|
|
$VERSION = '1.085'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
12
|
use Test::Builder; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
390
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $Test = Test::Builder->new(); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=encoding utf8 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Test::Env - test the environment |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Test::More tests => 1; |
24
|
|
|
|
|
|
|
use Test::Env; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
env_ok( 'PERL5LIB', "./blib/lib" ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 Functions |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over 4 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item env_ok( NAME, VALUE ) |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Ok if the environment variable NAME is VALUE. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub env_ok($$) { |
41
|
3
|
|
|
3
|
1
|
7054
|
my $name = shift; |
42
|
3
|
|
|
|
|
5
|
my $value = shift; |
43
|
|
|
|
|
|
|
|
44
|
3
|
100
|
|
|
|
13
|
unless( exists $ENV{$name} ) { |
|
|
100
|
|
|
|
|
|
45
|
1
|
|
|
|
|
5
|
$Test->ok(0); |
46
|
1
|
|
|
|
|
707
|
$Test->diag( "Environment variable [$name] missing!\n", |
47
|
|
|
|
|
|
|
"\tExpected [$value]\n" ); |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
0
|
elsif( $ENV{$name} ne $value ) { |
50
|
1
|
|
|
|
|
5
|
$Test->ok(0); |
51
|
1
|
|
|
|
|
828
|
$Test->diag( "Environment variable [$name] has wrong value!\n", |
52
|
|
|
|
|
|
|
"\tExpected [$value]\n", |
53
|
|
|
|
|
|
|
"\tGot [$ENV{$name}]\n" ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else |
56
|
|
|
|
|
|
|
{ |
57
|
1
|
|
|
|
|
4
|
$Test->ok(1); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=back |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This source is in GitHub: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
https://github.com/briandfoy/test-env |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
brian d foy, C<< >> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Copyright © 2002-2021, brian d foy . All rights reserved. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
78
|
|
|
|
|
|
|
it under the terms of the Artistic License 2.0. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
"Roscoe"; |