[Jifty-commit] r7477 - Template-Declare/trunk/t
Jifty commits
jifty-commit at lists.jifty.org
Thu Sep 3 18:35:17 EDT 2009
Author: theory
Date: Thu Sep 3 18:35:16 2009
New Revision: 7477
Modified:
Template-Declare/trunk/t/utf8.t
Template-Declare/trunk/t/utils.pl
Log:
Changed TODO tests in `t/utf8.t` back to regular tests by adding an optional
second argument to `ok_lint()`. When it has a true value, `ok_lint()` will
ignore errors with the HTML::Lint error code "text-use-entity". I also turned
off warnings during the parse, since my version of HTML::Lint, at least, is
kind of stupid about those errors.
Modified: Template-Declare/trunk/t/utf8.t
==============================================================================
--- Template-Declare/trunk/t/utf8.t (original)
+++ Template-Declare/trunk/t/utf8.t Thu Sep 3 18:35:16 2009
@@ -7,6 +7,8 @@
package Wifty::UI;
use base qw/Template::Declare/;
use Template::Declare::Tags;
+use Carp;
+$SIG{__WARN__} = \&Carp::cluck;
# 'test' in Russian
my $str = "\x{442}\x{435}\x{441}\x{442}";
@@ -47,20 +49,14 @@
{
my $simple = (show('tag_outs'));
ok($simple =~ m{^\s*<p>\s*$str\s*</p>\s*$}s);
- # diag ($simple);
- TODO: { local $TODO = "lint doesn't handle unicode sometimes";
- ok_lint($simple);
- }
+ ok_lint($simple, 1);
}
Template::Declare->buffer->clear;
{
my $simple = (show('double_tag_outs'));
ok($simple =~ m{^\s*<p>\s*$str\s*</p>\s*<p>\s*$str\s*</p>\s*$}s);
- # diag ($simple);
- TODO: { local $TODO = "lint doesn't handle unicode";
- ok_lint($simple);
- }
+ ok_lint($simple, 1);
}
Template::Declare->buffer->clear;
Modified: Template-Declare/trunk/t/utils.pl
==============================================================================
--- Template-Declare/trunk/t/utils.pl (original)
+++ Template-Declare/trunk/t/utils.pl Thu Sep 3 18:35:16 2009
@@ -4,7 +4,7 @@
use Test::More;
sub ok_lint {
- my $html = shift;
+ my ($html, $ignore_chars) = @_;
SKIP:
{
@@ -12,9 +12,16 @@
unless eval { require HTML::Lint; 1 };
my $lint = HTML::Lint->new;
- $lint->parse($html);
- is( $lint->errors, 0, "Lint checked clean" );
- foreach my $error ( $lint->errors ) {
+ do {
+ local $^W; # STFU HTML::Lint!
+ $lint->parse($html);
+ };
+ # Collect the errors, ignore the invalid character errors when requested.
+ my @errors = $ignore_chars
+ ? grep { $_->errcode ne 'text-use-entity' } $lint->errors
+ : $lint->errors;
+ is( @errors, 0, "Lint checked clean" );
+ foreach my $error ( @errors ) {
diag( $error->as_string );
}
}
More information about the Jifty-commit
mailing list