~ubuntu-branches/ubuntu/saucy/libclass-accessor-grouped-perl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/warnings.t

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2007-07-14 21:51:56 UTC
  • Revision ID: james.westby@ubuntu.com-20070714215156-l0iazyikbi21rpu8
Tags: upstream-0.07000
ImportĀ upstreamĀ versionĀ 0.07000

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl -wT
 
2
# $Id: /local/Class-Accessor-Grouped/t/warnings.t 1696 2007-05-11T01:34:21.515012Z claco  $
 
3
use strict;
 
4
use warnings;
 
5
 
 
6
BEGIN {
 
7
    use lib 't/lib';
 
8
    use Test::More;
 
9
    use File::Find;
 
10
    use File::Basename;
 
11
 
 
12
    plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR};
 
13
 
 
14
    eval 'use Test::Strict 0.05';
 
15
    plan skip_all => 'Test::Strict 0.05 not installed' if $@;
 
16
    plan skip_all => 'Need untaint in newer File::Find' if $] <= 5.006;
 
17
};
 
18
 
 
19
## I hope this can go away if Test::Strict or File::Find::Rule
 
20
## finally run under -T. Until then, I'm on my own here. ;-)
 
21
my @files;
 
22
my %trusted = (
 
23
    'NotReallyAClass.pm' => 1
 
24
);
 
25
 
 
26
find({  wanted => \&wanted,
 
27
        untaint => 1,
 
28
        untaint_pattern => qr|^([-+@\w./]+)$|,
 
29
        untaint_skip => 1,
 
30
        no_chdir => 1
 
31
}, qw(lib t));
 
32
 
 
33
sub wanted {
 
34
    my $name = $File::Find::name;
 
35
    my $file = fileparse($name);
 
36
 
 
37
    return if $name =~ /TestApp/;
 
38
 
 
39
    if ($name =~ /\.(pm|pl|t)$/i && !exists($trusted{$file})) {
 
40
        push @files, $name;
 
41
    };
 
42
};
 
43
 
 
44
if (scalar @files) {
 
45
    plan tests => scalar @files;
 
46
} else {
 
47
    plan tests => 1;
 
48
    fail 'No perl files found for Test::Strict checks!';
 
49
};
 
50
 
 
51
foreach (@files) {
 
52
   warnings_ok($_);
 
53
};