Changeset 2213


Ignore:
Timestamp:
12/28/08 07:12:04 (3 years ago)
Author:
szabgab
Message:

check for use warning without and s

Location:
trunk/Padre
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Document/Perl/Beginner.pm

    r2212 r2213  
    7777        } 
    7878    } 
     79    if ($text =~ /use\s+warning\s*;/) { 
     80        $self->{error} = "You need to write use warnings (with an s at the end) and not use warning."; 
     81        return; 
     82    } 
     83 
    7984    return 1; 
    8085} 
  • trunk/Padre/t/75-perl-beginner.t

    r2212 r2213  
    1717BEGIN { $tests += 1; } 
    1818 
    19 my %tests = ( 
    20     'split1.pl' => "The second parameter of split is a string, not an array", 
    21     'split2.pl' => "The second parameter of split is a string, not an array", 
    22 ); 
     19my %tests; 
     20BEGIN { 
     21    %tests = ( 
     22    'split1.pl'  => "The second parameter of split is a string, not an array", 
     23    'split2.pl'  => "The second parameter of split is a string, not an array", 
     24    'warning.pl' => "You need to write use warnings (with an s at the end) and not use warning.", 
     25    ); 
     26} 
    2327 
    2428foreach my $file (keys %tests) { 
     
    2630    ok(! defined($b->check($data)), $file); 
    2731    is($b->error, $tests{$file}, "$file error"); 
    28     BEGIN { $tests += 2 * 2; } 
     32    BEGIN { $tests += 2 * keys %tests; } 
    2933} 
    3034 
Note: See TracChangeset for help on using the changeset viewer.