[libvirt] [tck PATCH v2 12/15] lib: use Test::More directly instead of Test::Builder

Daniel P. Berrangé berrange at redhat.com
Fri Jun 8 14:55:04 UTC 2018


Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 lib/Sys/Virt/TCK.pm | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index 29280f6..1a835bd 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -35,7 +35,7 @@ use XML::XPath;
 use Carp qw(cluck carp);
 use Fcntl qw(O_RDONLY SEEK_END);
 
-use Test::Builder;
+use Test::More;
 use Sub::Uplevel qw(uplevel);
 use base qw(Exporter);
 
@@ -1035,8 +1035,6 @@ sub _try_as_caller {
 };
 
 
-my $Tester = Test::Builder->new;
-
 sub ok_object($$$;$) {
     my $coderef = shift;
     my $class = shift;
@@ -1052,16 +1050,16 @@ sub ok_object($$$;$) {
         $ret && ref($ret) && $ret->isa($class) &&
         (!defined $name || ($ret->get_name() eq $name));
 
-    $Tester->ok($ok, $description);
+    ok($ok, $description);
     unless ($ok) {
-        $Tester->diag("expected $class object" . ($name ? " with name $name" : ""));
+        diag("expected $class object" . ($name ? " with name $name" : ""));
         if ($exception) {
-            $Tester->diag("found '$exception'");
+            diag("found '$exception'");
         } else {
             if ($ret && ref($ret) && $ret->isa($class)) {
-                $Tester->diag("found $class object with name " . $ret->get_name);
+                diag("found $class object with name " . $ret->get_name);
             } else {
-                $Tester->diag("found '$ret'");
+                diag("found '$ret'");
             }
         }
     }
@@ -1137,10 +1135,10 @@ sub ok_error(&$;$) {
     my $ok = ref($exception) && $exception->isa("Sys::Virt::Error") &&
         (!defined $code || ($exception->code() == $code));
 
-    $Tester->ok($ok, $description);
+    ok($ok, $description);
     unless ($ok) {
-        $Tester->diag("expecting Sys::Virt::Error object" . ($code ?  " with code $code" : ""));
-        $Tester->diag("found '$exception'");
+        diag("expecting Sys::Virt::Error object" . ($code ?  " with code $code" : ""));
+        diag("found '$exception'");
     }
     $@ = $exception;
     return $ok;
-- 
2.17.0




More information about the libvir-list mailing list