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
|
#!/usr/bin/perl -I.
use strict;
use warnings;
use t::Test::abeltje;
use Cwd "abs_path";
use File::Spec::Functions;
require_ok ("V");
{ my $version;
my $warning = warning {
$version = V::get_version ("GH::Issue1");
};
is ($version, "1.3", "Find specific version");
if ($] < 5.012) {
is_deeply (
$warning, [
qq{Your perl doesn't understand the version declaration of Foo\n},
qq{Your perl doesn't understand the version declaration of GH::Issue1\n},
],
"Found warning for perl $]") or diag (explain ($warning));
}
else {
is_deeply ($warning, [], "No warnings for perl $]")
or diag (explain ($warning));
}
}
{ my ($stdout, $warning);
{ no warnings "once";
local *STDOUT;
open *STDOUT, ">>", \$stdout;
local $V::NO_EXIT = 1;
local @INC = "t/lib";
$warning = warning { V->import ("GH::Issue1") };
}
is ($stdout, <<"EOT", "All packages in output") or diag ("STDOUT: $stdout");
GH::Issue1
\t@{[canonpath (catfile (abs_path ("."), qw( t lib GH Issue1.pm )))]}:
\t main: 1.1
\t Foo: 1.2
\t GH::Issue1: 1.3
EOT
if ($] < 5.012) {
is_deeply (
$warning, [
qq{Your perl doesn't understand the version declaration of Foo\n},
qq{Your perl doesn't understand the version declaration of GH::Issue1\n},
],
"Found warning for perl $]"
) or diag (explain ($warning));
}
else {
is_deeply ($warning, [], "No warnings for perl $]")
or diag (explain ($warning));
}
}
abeltje_done_testing ();
|