File: warnings_exist.t

package info (click to toggle)
libtest-warn-perl 0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 128 kB
  • ctags: 20
  • sloc: perl: 713; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 753 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
#!/usr/bin/perl

use strict;
use warnings;

use Carp;
use Test::More qw(no_plan);

my $file="t/warnings_exist1.pl";
my $output=`$^X -Mblib $file 2>&1`;
$output=~s/^#.*$//gm;
$output=~s/\n{2,}/\n/gs;
my @lines=split /[\n\r]+/,$output;
shift @lines if $lines[0]=~/^Using /; #extra line in perl 5.6.2
#print $output;
my @expected=(
"warn_2 at $file line 12.",
'ok 1',
'ok 2',
"warn_2 at $file line 21.",
'not ok 3',
"warn_2 at $file line 27.",
'ok 4',
"warn_2 at $file line 31.",
'not ok 5',
qr/^Use of uninitialized value (?:\$a\s+)?in addition \(\+\) at \Q$file\E line 36\.$/,
'ok 6',
'1..6'
);
foreach my $i (0..$#expected) {
  if ($expected[$i]=~/^\(\?\w*-\w*:/) {
    like($lines[$i],$expected[$i]);
  } else {
    is($lines[$i],$expected[$i]);
  }
}