File: 06_multi_version.t

package info (click to toggle)
libv-perl 0.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192 kB
  • sloc: perl: 556; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,503 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
#!/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 ();