Skip to content

Commit

Permalink
Trying a new approach to testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lancew committed Aug 15, 2014
1 parent c9fcf26 commit 9546afc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
26 changes: 6 additions & 20 deletions t/20_policies.t
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
use strict;
use warnings;
use Perl::Critic;
use Test::More;
use Perl::Critic::TestUtils qw( pcritique );


my $code = <<'__CODE__';
print 0+ '23a';
}
__CODE__

is pcritique('Perlsecret', \$code), 1;

$code = <<'__CODE__';
for ( @{[ qw( 1 2 3 ) ]} ) {
$_ = $_ * $_; # contrived
print "square: $_\n";
}
__CODE__

is pcritique('Perlsecret', \$code), 1;

my $critic = Perl::Critic->new;
$critic->add_policy(-policy => "Perl::Critic::Policy::Perlsecret");

my @v = $critic->critique("t/Perlsecret/Perlsecret.run");

ok @v == 2;
like $v[0], qr/Perlsecret/;

done_testing;

Expand Down
2 changes: 2 additions & 0 deletions t/Perlsecret/Perlsecret.run
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## Venus operator
print 0+ '23a';

## Babycart
for ( @{[ qw( 1 2 3 ) ]} ) { return $_ };

0 comments on commit 9546afc

Please sign in to comment.