
On 06/08/2018 10:55 AM, Daniel P. Berrangé wrote:
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
I don't pretend to know much of anything about this testing framework, but I guess this make the code here more like what's in the other files. Reviewed-by: Laine Stump <laine@laine.org>
--- 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;