[Http-webtest-commits] HTTP-WebTest/lib/HTTP/WebTest SelfTest.pm,1.4,1.5
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <m_...@us...> - 2002-12-22 21:25:58
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory sc8-pr-cvs1:/tmp/cvs-serv10051/lib/HTTP/WebTest Modified Files: SelfTest.pm Log Message: Port self-test suite from Test to Test::More Index: SelfTest.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/SelfTest.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SelfTest.pm 22 Dec 2002 20:35:39 -0000 1.4 --- SelfTest.pm 22 Dec 2002 21:25:50 -0000 1.5 *************** *** 43,47 **** use MIME::Base64; use Sys::Hostname; - use Test; use URI; --- 43,46 ---- *************** *** 62,66 **** =cut ! $PORT = find_port(hostname => $HOSTNAME); die "Can't find free port" unless defined $PORT; --- 61,65 ---- =cut ! $PORT = find_port(); die "Can't find free port" unless defined $PORT; *************** *** 337,341 **** my $output1 = read_file($check_file, 1); _print_diff($output1, $output2); ! ok(($output1 eq $output2) or defined $ENV{TEST_FIX}); if(defined $ENV{TEST_FIX} and $output1 ne $output2) { --- 336,340 ---- my $output1 = read_file($check_file, 1); _print_diff($output1, $output2); ! _ok(($output1 eq $output2) or defined $ENV{TEST_FIX}); if(defined $ENV{TEST_FIX} and $output1 ne $output2) { *************** *** 343,346 **** --- 342,358 ---- write_file($check_file, $output2); + } + } + + # ok compatible with Test and Test::Builder + sub _ok { + # if Test is already loaded use its ok + if(Test->can('ok')) { + @_ = $_[0]; + goto \&Test::ok; + } else { + require Test::Builder; + local $Test::Builder::Level = $Test::Builder::Level + 1; + Test::Builder->new->ok(@_); } } |