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
|
#!/usr/bin/perl -w
use strict;
use Test::More tests => 22;
use constant SKIP => 18;
##############################################################################
# Make sure that we can use the stuff that's in our local lib directory.
BEGIN {
unshift @INC, 't/lib', 'lib';
}
chdir 't';
use EventTest;
##############################################################################
BEGIN { use_ok('App::Info::Lib::OSSPUUID') }
my $ext = $^O eq 'MSWin32' ? '[.]exe' : '';
# Test info events.
ok( my $info = EventTest->new, "Create info EventTest" );
ok( my $uuid = App::Info::Lib::OSSPUUID->new( on_info => $info ),
"Got Object");
is( $info->message, "Looking for uuid-config", "Check constructor info" );
SKIP: {
# Skip tests?
skip 'OSSP UUID Library not installed', SKIP unless $uuid->installed;
# Check name.
$uuid->name;
like($info->message, qr/^Executing `".*uuid-config$ext" --version`$/,
"Check name info" );
$uuid->name;
ok( ! defined $info->message, "No info" );
$uuid->version;
ok( ! defined $info->message, "Still No info" );
# Check version.
ok( $uuid = App::Info::Lib::OSSPUUID->new( on_info => $info ),
"Got Object 2");
$info->message; # Throw away constructor message.
$uuid->version;
like($info->message, qr/^Executing `".*uuid-config$ext" --version`$/,
"Check version info" );
$uuid->version;
ok( ! defined $info->message, "No info" );
$uuid->major_version;
ok( ! defined $info->message, "Still No info" );
# Check major version.
ok( $uuid = App::Info::Lib::OSSPUUID->new( on_info => $info ),
"Got Object 3");
$info->message; # Throw away constructor message.
$uuid->major_version;
like($info->message, qr/^Executing `".*uuid-config$ext" --version`$/,
"Check major info" );
# Check minor version.
ok( $uuid = App::Info::Lib::OSSPUUID->new( on_info => $info ),
"Got Object 4");
$info->message; # Throw away constructor message.
$uuid->minor_version;
like($info->message, qr/^Executing `".*uuid-config$ext" --version`$/,
"Check minor info" );
# Check patch version.
ok( $uuid = App::Info::Lib::OSSPUUID->new( on_info => $info ),
"Got Object 5");
$info->message; # Throw away constructor message.
$uuid->patch_version;
like($info->message, qr/^Executing `".*uuid-config$ext" --version`$/,
"Check patch info" );
# Check dir methods.
$uuid->bin_dir;
like( $info->message, qr/^Executing `".*uuid-config$ext" --bindir`$/,
"Check bin info" );
$uuid->inc_dir;
like( $info->message, qr/^Executing `".*uuid-config$ext" --includedir`$/,
"Check inc info" );
$uuid->lib_dir;
like( $info->message, qr/^Executing `".*uuid-config$ext" --libdir`$/,
"Check lib info" );
$uuid->cflags;
# Check configure info.
like( $info->message, qr/^Executing `".*uuid-config$ext" --cflags`$/,
"Check cflags info" );
$uuid->ldflags;
like( $info->message, qr/^Executing `".*uuid-config$ext" --ldflags`$/,
"Check ldflags info" );
}
__END__
|