[Rt-commit] rt branch, 4.2/silence-test-warnings, created. rt-4.0.8-488-g75a8b43

Thomas Sibley trs at bestpractical.com
Wed Nov 14 19:47:03 EST 2012


The branch, 4.2/silence-test-warnings has been created
        at  75a8b43b4d3b446529aa9d14f2ba8de612e44674 (commit)

- Log -----------------------------------------------------------------
commit 224b96e5ca93f8beb07264453a8ba2e3035815f2
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Nov 14 16:43:23 2012 -0800

    Catch specific warnings emitted by three test files
    
    Tests should now be warnings clean once again.

diff --git a/t/api/squish.t b/t/api/squish.t
index 5961536..4b0fc5f 100644
--- a/t/api/squish.t
+++ b/t/api/squish.t
@@ -1,11 +1,16 @@
 use strict;
 use warnings;
 use RT;
-use RT::Test nodb => 1, tests => 7;
+use RT::Test nodb => 1, tests => undef;
+use Test::Warn;
 
 use RT::Squish;
 
-my $squish = RT::Squish->new();
+my $squish;
+warning_like {
+    $squish = RT::Squish->new();
+} [qr/implement/], "warns this is only an abstract base class";
+
 for my $method ( qw/Content ModifiedTime ModifiedTimeString Key/ ) {
     can_ok($squish, $method);
 }
@@ -14,3 +19,5 @@ ok( (time()-$squish->ModifiedTime) <= 2, 'ModifiedTime' );
 
 use RT::Squish::CSS;
 can_ok('RT::Squish::CSS', 'Style');
+
+done_testing;
diff --git a/t/customfields/ip.t b/t/customfields/ip.t
index a16ae51..6a97db2 100644
--- a/t/customfields/ip.t
+++ b/t/customfields/ip.t
@@ -2,7 +2,8 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 73;
+use RT::Test tests => undef;
+use Test::Warn;
 
 my ( $baseurl, $agent ) = RT::Test->started_ok;
 ok( $agent->login, 'log in' );
@@ -264,7 +265,9 @@ diag "create a ticket with an IP of 10.0.0.1 and search for doesn't match '10.0.
     ok( $id, "created first ticket $id" );
 
     my $tickets = RT::Tickets->new($RT::SystemUser);
-    $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE '10.0.0.'");
+    warning_like {
+        $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE '10.0.0.'");
+    } [qr/not a valid IPAddress/], "caught warning about valid IP address";
 
     SKIP: {
         skip "partical ip parse causes ambiguity", 1;
@@ -282,3 +285,6 @@ diag "test the operators in search page" if $ENV{'TEST_VERBOSE'};
     ok( $op, "found CF.{IP}Op" );
     is_deeply( [ $op->possible_values ], [ '=', '!=', '<', '>' ], 'op values' );
 }
+
+undef $agent;
+done_testing;
diff --git a/t/customfields/ipv6.t b/t/customfields/ipv6.t
index 0d4075f..f97420e 100644
--- a/t/customfields/ipv6.t
+++ b/t/customfields/ipv6.t
@@ -2,7 +2,8 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 102;
+use RT::Test tests => undef;
+use Test::Warn;
 
 my ( $baseurl, $agent ) = RT::Test->started_ok;
 ok( $agent->login, 'log in' );
@@ -241,7 +242,9 @@ diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd
     ok( $id, "created first ticket $id" );
 
     my $tickets = RT::Tickets->new($RT::SystemUser);
-    $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE 'abcd:23'");
+    warning_like {
+        $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE 'abcd:23'");
+    } [qr/not a valid IPAddress/], "caught warning about IPAddress";
 
     SKIP: {
         skip "partical ip parse can causes ambiguity", 1;
@@ -249,3 +252,5 @@ diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd
     }
 }
 
+undef $agent;
+done_testing;

commit 75a8b43b4d3b446529aa9d14f2ba8de612e44674
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Nov 14 16:44:20 2012 -0800

    TODO failing tests instead of skipping them
    
    Skipping is meant for when the test can't be completely successfully,
    not when it's just currently broken.
    
    We should track TODO tests so that they aren't just lost, and we can
    eventually fix them.

diff --git a/t/customfields/ip.t b/t/customfields/ip.t
index 6a97db2..60e68a4 100644
--- a/t/customfields/ip.t
+++ b/t/customfields/ip.t
@@ -269,8 +269,8 @@ diag "create a ticket with an IP of 10.0.0.1 and search for doesn't match '10.0.
         $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE '10.0.0.'");
     } [qr/not a valid IPAddress/], "caught warning about valid IP address";
 
-    SKIP: {
-        skip "partical ip parse causes ambiguity", 1;
+    TODO: {
+        local $TODO = "partial ip parse causes ambiguity";
         is( $tickets->Count, 0, "should not have found the ticket" );
     }
 }
diff --git a/t/customfields/ipv6.t b/t/customfields/ipv6.t
index f97420e..ad34f42 100644
--- a/t/customfields/ipv6.t
+++ b/t/customfields/ipv6.t
@@ -246,8 +246,8 @@ diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd
         $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE 'abcd:23'");
     } [qr/not a valid IPAddress/], "caught warning about IPAddress";
 
-    SKIP: {
-        skip "partical ip parse can causes ambiguity", 1;
+    TODO: {
+        local $TODO = "partial ip parse can causes ambiguity";
         is( $tickets->Count, 0, "should not have found the ticket" );
     }
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list