Skip to content
This repository has been archived by the owner on Apr 14, 2019. It is now read-only.

Commit

Permalink
Fix test failures on windows. GH #11, GH #23
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed May 27, 2017
1 parent 35a7127 commit f4ff587
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changes
Expand Up @@ -2,6 +2,10 @@ Revision history for Perl extension HTML::Tidy.

NEXT
====================================
[FIXES]
Failing tests on Windows. Thanks, Klaus Baldermann. (GH #11, GH #23)


[INTERNALS]
Added more tests. Thanks, Hunter McMillen.

Expand Down
9 changes: 6 additions & 3 deletions t/unicode-nbsp.t
Expand Up @@ -3,7 +3,7 @@
use warnings;
use strict;

use Test::More tests => 2;
use Test::More tests => 3;

use HTML::Tidy;

Expand All @@ -12,9 +12,12 @@ use Encode;
my $bytes_string = "\x{c2}\x{a0}"; #UTF8 nbsp
my $perl_chars = Encode::decode('utf8',$bytes_string); #perl chars of utf8 byte string

my $expected_after_tidy = " \n"; # HTML::Tidy adds a \n and should convert the nbsp to an HTML entity

my $tidy = HTML::Tidy->new({ show_body_only => 1 });

my $newline = $tidy->clean( '' ); # HTML::Tidy adds a platform dependant "newline"
like( $newline, qr/^\r?\n?$/, 'Tidy Newline' ); # should be CR or LF or both

my $expected_after_tidy = " $newline"; # HTML::Tidy should convert the nbsp to an HTML entity (and adds a newline)

is( $tidy->clean( $perl_chars ), $expected_after_tidy, 'Perl chars OK' );
is( $tidy->clean( $bytes_string ), $expected_after_tidy, 'Byte string OK' );

0 comments on commit f4ff587

Please sign in to comment.