Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix perlcritic issues #14

Merged
merged 3 commits into from Jun 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion t/01_use.t
@@ -1,5 +1,8 @@
# Check this module loads
#

use strict;
use warnings;

use Test::More tests => 1;

BEGIN {
Expand Down
3 changes: 3 additions & 0 deletions t/02_basic.t
Expand Up @@ -5,6 +5,9 @@

# change 'tests => 1' to 'tests => last_test_to_print';

use strict;
use warnings;

use Test;
BEGIN { plan tests => 77 }
use HTML::Scrubber;
Expand Down
29 changes: 14 additions & 15 deletions t/06_scrub_file.t
Expand Up @@ -25,33 +25,32 @@ SKIP: {
$r = "Error: \$@=$@ \$!=$!" unless $r;
is( $r, 1, "scrub(\$html,\$tmpfile=$tmpfile)" );

local *FILIS;
open FILIS, "+>$tmpfile" or die "can't write to $tmpfile";
open my $filis, "+>", $tmpfile or die "can't write to $tmpfile";

$r = $s->scrub( $html, \*FILIS );
$r = $s->scrub( $html, $filis );
$r = "Error: \$@=$@ \$!=$!" unless $r;

is( $r, 1, q[scrub($html,\*FILIS)] );
is( $r, 1, q[scrub($html, $filis)] );

seek *FILIS, 0, 0;
$r = join '', readline *FILIS;
is( $r, "histart mid1 mid2 end", "FILIS has the right stuff" );
is( close(FILIS), 1, q[close(FILIS)] );
seek $filis, 0, 0;
$r = join '', readline $filis;
is( $r, "histart mid1 mid2 end", '$filis has the right stuff' );
is( close($filis), 1, q[close($filis)] );

my ( $tfh2, $tmpfile2 ) = tempfile( $template, DIR => $tmpdir, SUFFIX => '.html' );
$r = $s->scrub_file( $tmpfile, "$tmpfile2" );
$r = "Error: \$@=$@ \$!=$!" unless $r;

is( $r, 1, qq[scrub_file(\$tmpfile,"\$tmpfile2"=$tmpfile2)] );

open FILIS, "+>$tmpfile2" or die "can't write to $tmpfile";
$r = $s->scrub_file( $tmpfile, \*FILIS );
open $filis, "+>", $tmpfile2 or die "can't write to $tmpfile";
$r = $s->scrub_file( $tmpfile, $filis );
$r = "Error: \$@=$@ \$!=$!" unless $r;

is( $r, 1, q[scrub_file($tmpfile,\*FILIS)] );
seek *FILIS, 0, 0;
$r = join '', readline *FILIS;
is( $r, "histart mid1 mid2 end", "FILIS has the right stuff" );
is( close(FILIS), 1, q[close(FILIS)] );
is( $r, 1, q[scrub_file($tmpfile, $filis)] );
seek $filis, 0, 0;
$r = join '', readline $filis;
is( $r, "histart mid1 mid2 end", '$filis has the right stuff' );
is( close($filis), 1, q[close($filis)] );

}
2 changes: 2 additions & 0 deletions t/09_memory_cycle.t
@@ -1,3 +1,5 @@
use strict;
use warnings;

use Test::More tests => 1;
use Test::Memory::Cycle;
Expand Down