Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failing tests due to hash ordering changes in perl 5.18
- Loading branch information
Andy Jones
committed
Feb 5, 2015
1 parent
984a89b
commit f328c39
Showing
6 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package TestHelpers; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use HTML::TreeBuilder; | ||
use Test::Differences 'eq_or_diff_text'; | ||
|
||
# This is a minimal clone of Test::Differences::HTML | ||
# which has failing tests because Test::Differences has changed the output | ||
# in version 0.63 (see RT#100514) | ||
sub eq_or_diff_html { | ||
my ($raw, $expected, $label) = @_; | ||
|
||
return eq_or_diff_text(_normalise_html($raw), _normalise_html($expected), $label); | ||
} | ||
|
||
sub _normalise_html { | ||
my ($dirty_html) = @_; | ||
|
||
# Normalise the HTML by parsing it | ||
my $tree = HTML::TreeBuilder->new_from_content($dirty_html); | ||
my $clean_html = $tree->as_HTML; | ||
|
||
$tree = $tree->delete; # don't assume we have TreeBuilder 5 | ||
|
||
return $clean_html; | ||
} | ||
|
||
1; |