Ticket #846: fix-14-warnings.patch

File fix-14-warnings.patch, 2.2 KB (added by rhebus, 5 years ago)

Patch to fake the Padre class and allow calls to Padre->ide->config

  • t/14-warnings.t

     
    77use Test::NoWarnings; 
    88use Padre::Document::Perl::Beginner; 
    99 
     10package Padre; 
     11# Fake the Padre instance, P::D::P::Beginner only needs Padre->ide->config 
     12use Padre::Config(); 
     13my $SINGLETON = undef; 
     14sub ide { 
     15    my $class = shift; 
     16    return $SINGLETON if $SINGLETON; 
     17    $SINGLETON = bless {}, $class; 
     18    $SINGLETON->{config} = Padre::Config->read; 
     19    return $SINGLETON; 
     20} 
     21sub config { 
     22    my $self = shift; 
     23    return $self->{config}; 
     24} 
     25 
     26package main; 
     27 
    1028our $SKIP; 
    1129 
    1230unless ( $ENV{AUTOMATED_TESTING} ) { 
     
    3856 
    3957    $b->check( slurp( 'lib/' . $file ) ); 
    4058    my $result = $b->error || ''; 
    41     ok( ( $result eq '' ), 'Check ' . $file . ': ' . $result ); 
     59    ok( ( $result eq '' ), "Check $file: $result" ); 
    4260} 
    4361 
    4462 
     
    5068 
    5169sub slurp { 
    5270    my $file = shift; 
    53     open my $fh, '<', $file or die $!; 
     71    open my $fh, '<', $file or die "Couldn't open $file: $!"; 
    5472    local $/ = undef; 
    5573    my $buffer = <$fh>; 
    5674    close $fh;