File: compile.t

package info (click to toggle)
libtest2-plugin-nowarnings-perl 0.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: perl: 268; sh: 23; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 866 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;

use Test2::V0;
use Test2::Plugin::NoWarnings;
use Test2::Require::Module 'IPC::Run3';

use IPC::Run3 qw( run3 );

plan skip_all
    'IPC::Run3 does not play well with Windows when scripts exit non-0'
    if $^O eq 'MSWin32';

my $code = <<'EOF';
use strict;
use warnings;

# We need to load Test::Builder to trigger the weird failure case.
package Foo;
use Test::Builder;

package main;

use Test2::V0;
use Test2::Plugin::NoWarnings;

# It we name the variable "$array" we don't get the broken output. Perl is
# weird.
splice @$arr, 3 1;
my $arr = [qw/a b c/];
ok( 1, 'abc' );

done_testing();
EOF

my ( $stdout, $stderr );
run3(
    [ $^X, '-e', $code ],
    \undef,
    \$stdout,
    \$stderr,
);

like(
    $stderr,
    qr/Global symbol/,
    'compile time warning is not hidden by using Test2::Plugin::NoWarnings'
);

done_testing();