[Jifty-commit] r2496 - in Template-Declare: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jan 15 16:15:16 EST 2007


Author: jesse
Date: Mon Jan 15 16:15:15 2007
New Revision: 2496

Added:
   Template-Declare/t/utils.pl
Modified:
   Template-Declare/   (props changed)
   Template-Declare/t/arg-declaration-styles.t
   Template-Declare/t/importing.t
   Template-Declare/t/indexhtml.t
   Template-Declare/t/private.t
   Template-Declare/t/subclassing.t
   Template-Declare/t/subtemplates.t
   Template-Declare/t/trivial.t
   Template-Declare/t/xss.t

Log:
 r20985 at hualien:  jesse | 2007-01-15 16:11:22 -0500
  * refactoring the tests utility fucntions


Modified: Template-Declare/t/arg-declaration-styles.t
==============================================================================
--- Template-Declare/t/arg-declaration-styles.t	(original)
+++ Template-Declare/t/arg-declaration-styles.t	Mon Jan 15 16:15:15 2007
@@ -64,7 +64,7 @@
 };
 
 use Test::More tests => 39;
-use HTML::Lint;
+require "t/utils.pl";
 
 Template::Declare->init(roots => ['TestApp::UI']);
 
@@ -81,20 +81,6 @@
     ok_multicontent( show($_), $_ );
 }
 
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-
-        #diag( $error->as_string );
-    }
-
-}
-
 sub ok_multicontent {
     my $simple = shift;
     my $test   = shift;

Modified: Template-Declare/t/importing.t
==============================================================================
--- Template-Declare/t/importing.t	(original)
+++ Template-Declare/t/importing.t	Mon Jan 15 16:15:15 2007
@@ -40,7 +40,7 @@
 Template::Declare->init( roots => ['Wifty::UI'] );
 
 use Test::More tests => 10;
-use HTML::Lint;
+require "t/utils.pl";
 
 ok( Wifty::UI::imported_pkg->has_template('imported') );
 ok( Wifty::UI::imported_subclass_pkg->has_template('imported') );
@@ -73,17 +73,4 @@
     ok_lint($simple);
 }
 
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
-
 1;

Modified: Template-Declare/t/indexhtml.t
==============================================================================
--- Template-Declare/t/indexhtml.t	(original)
+++ Template-Declare/t/indexhtml.t	Mon Jan 15 16:15:15 2007
@@ -36,7 +36,8 @@
 };
 
 
-use HTML::Lint;
+require "t/utils.pl";
+
 Template::Declare->init(roots => ['Wifty::UI']);
 
 
@@ -53,18 +54,4 @@
 }
 
 
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
-
-
 1;

Modified: Template-Declare/t/private.t
==============================================================================
--- Template-Declare/t/private.t	(original)
+++ Template-Declare/t/private.t	Mon Jan 15 16:15:15 2007
@@ -36,7 +36,7 @@
 Template::Declare->init(roots => ['Wifty::UI']);
 
 use Test::More tests => 7;
-use HTML::Lint;
+require "t/utils.pl";
 
 {
     local $Template::Declare::Tags::BUFFER;
@@ -58,17 +58,5 @@
     ok_lint($simple);
 }
 
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
 
 1;

Modified: Template-Declare/t/subclassing.t
==============================================================================
--- Template-Declare/t/subclassing.t	(original)
+++ Template-Declare/t/subclassing.t	Mon Jan 15 16:15:15 2007
@@ -51,8 +51,7 @@
 Template::Declare->init(roots => ['Baseclass::UI', 'Wifty::UI']);
 
 use Test::More tests => 9;
-use HTML::Lint;
-
+require "t/utils.pl";
 
 {
     local $Template::Declare::Tags::BUFFER;
@@ -87,17 +86,4 @@
 }
 
 
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
-
 1;

Modified: Template-Declare/t/subtemplates.t
==============================================================================
--- Template-Declare/t/subtemplates.t	(original)
+++ Template-Declare/t/subtemplates.t	Mon Jan 15 16:15:15 2007
@@ -6,6 +6,7 @@
 use base qw/Template::Declare/;
 use Template::Declare::Tags;
 use Test::More tests => 4;
+require "t/utils.pl";
 
 template simple => sub {
 
@@ -25,7 +26,6 @@
 
 };
 
-use HTML::Lint;
 
 Template::Declare->init(roots => ['Wifty::UI']);
 
@@ -44,18 +44,6 @@
 #diag ($simple);
 ok_lint($simple);
 }
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
 
 
 1;

Modified: Template-Declare/t/trivial.t
==============================================================================
--- Template-Declare/t/trivial.t	(original)
+++ Template-Declare/t/trivial.t	Mon Jan 15 16:15:15 2007
@@ -136,9 +136,8 @@
 };
 
 package Template::Declare::Tags;
-
+require "t/utils.pl";
 use Test::More;
-use HTML::Lint;
 
 our $self;
 local $self = {};
@@ -164,18 +163,6 @@
 ok_lint($out);
 
 }
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
 
 
 1;

Added: Template-Declare/t/utils.pl
==============================================================================
--- (empty file)
+++ Template-Declare/t/utils.pl	Mon Jan 15 16:15:15 2007
@@ -0,0 +1,21 @@
+use warnings;
+use strict;
+
+use Test::More;
+use HTML::Lint;
+
+sub ok_lint {
+    my $html = shift;
+
+    my $lint = HTML::Lint->new;
+
+    $lint->parse($html);
+    is( $lint->errors, 0, "Lint checked clean" );
+    foreach my $error ( $lint->errors ) {
+        diag( $error->as_string );
+    }
+
+}
+
+
+1;

Modified: Template-Declare/t/xss.t
==============================================================================
--- Template-Declare/t/xss.t	(original)
+++ Template-Declare/t/xss.t	Mon Jan 15 16:15:15 2007
@@ -16,7 +16,7 @@
 package Template::Declare::Tags;
 
 use Test::More;
-use HTML::Lint;
+require "t/utils.pl";
 
 our $self;
 local $self = {};
@@ -41,18 +41,6 @@
 ok_lint($simple);
 }
 }
-sub ok_lint {
-    my $html = shift;
-
-    my $lint = HTML::Lint->new;
-
-    $lint->parse($html);
-    is( $lint->errors, 0, "Lint checked clean" );
-    foreach my $error ( $lint->errors ) {
-        diag( $error->as_string );
-    }
-
-}
 
 
 1;


More information about the Jifty-commit mailing list