File: confirm.t

package info (click to toggle)
libapp-info-perl 0.57-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 660 kB
  • sloc: perl: 3,762; ansic: 4; makefile: 2
file content (97 lines) | stat: -rwxr-xr-x 3,388 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w

use strict;
use File::Spec::Functions qw(tmpdir);
use Test::More tests => 14;

##############################################################################
# Make sure that we can use the stuff that's in our local lib directory.
BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't' if -d 't';
        @INC = ('../lib', 'lib');
    } else {
        unshift @INC, 't/lib', 'lib';
    }
}
chdir 't';
use TieOut;

##############################################################################
# Load classes and create prompt object.
BEGIN { use_ok('App::Info::HTTPD::Apache') }
BEGIN { use_ok('App::Info::RDBMS::PostgreSQL') }
BEGIN { use_ok('App::Info::Lib::Expat') }
BEGIN { use_ok('App::Info::Lib::Iconv') }
BEGIN { use_ok('App::Info::Handler::Prompt') }
ok( my $p = App::Info::Handler::Prompt->new, "Create prompt" );
$p->{tty} = 1; # Cheat death.

##############################################################################
# Tie STDOUT and STDIN so I can read them.
my $stdout = tie *STDOUT, 'TieOut' or die "Cannot tie STDOUT: $!\n";
my $stdin = tie *STDIN, 'TieOut' or die "Cannot tie STDIN: $!\n";

##############################################################################
# Test Apache.
##############################################################################
# Set up a couple of answers.
print STDIN "foo3424324\n";
print STDIN "\n";

ok( App::Info::HTTPD::Apache->new( on_confirm => $p,
                                   on_unknown => $p ),
    "Set up for Apache confirm" );

my $expected = qr/Path to your httpd executable?.* Not an executable: 'foo3424324'\nPath to your httpd executable?/;

like ($stdout->read, $expected, "Check Apache cofirm" );

##############################################################################
# Test PostgreSQL.
##############################################################################
# Set up a couple of answers.
print STDIN "foo3424324\n";
print STDIN "\n";

ok( App::Info::RDBMS::PostgreSQL->new( on_confirm => $p,
                                       on_unknown => $p ),
    "Set up for Pg confirm" );

$expected = qr/Path to pg_config?.* Not an executable: 'foo3424324'\nPath to pg_config?/;

like ($stdout->read, $expected, "Check Pg cofirm" );

##############################################################################
# Test Expat.
##############################################################################
# Set up a couple of answers.
print STDIN "foo3424324\n";
print STDIN "\n";

ok( App::Info::Lib::Expat->new( on_confirm => $p,
                                on_unknown => $p ),
    "Set up for Expat confirm" );

$expected = qr/Path to Expat library directory?.* No Expat libraries found in directory: 'foo3424324'\nPath to Expat library directory?/;

like ($stdout->read, $expected, "Check Expat cofirm" );

##############################################################################
# Test Iconv.
##############################################################################
# Set up a couple of answers.
print STDIN "foo3424324\n";
print STDIN "\n";

ok( App::Info::Lib::Iconv->new( on_confirm => $p,
                                on_unknown => $p ),
    "Set up for Iconv confirm" );

$expected = qr/Path to iconv executable?.* Not an executable: 'foo3424324'\nPath to iconv executable?/;

like ($stdout->read, $expected, "Check Iconv cofirm" );



__END__