From: Nicholas Clark Date: Thu, 3 Mar 2011 14:44:31 +0000 (+0000) Subject: In ReTest.pl, provide is(), isnt(), like() and unlike(), equivalent to test.pl X-Git-Tag: accepted/trunk/20130322.191538~5178 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3515e673ce2aaf04ce01390f2bb491aa998c5a3;p=platform%2Fupstream%2Fperl.git In ReTest.pl, provide is(), isnt(), like() and unlike(), equivalent to test.pl This will ease the migration of the users of ReTest.pl to test.pl --- diff --git a/t/re/ReTest.pl b/t/re/ReTest.pl index ee147aa..561c36b 100644 --- a/t/re/ReTest.pl +++ b/t/re/ReTest.pl @@ -156,6 +156,28 @@ sub isneq ($$;$) { _ok $pass, $name, $error; } +*is = \&iseq; +*isnt = \&isneq; + +sub like ($$$) { + my (undef, $expected, $name) = @_; + my ($pass, $error); + $pass = $_[0] =~ /$expected/; + unless ($pass) { + $error = "# got '$_[0]'\n# expected /$expected/"; + } + _ok($pass, $name, $error); +} + +sub unlike ($$$) { + my (undef, $expected, $name) = @_; + my ($pass, $error); + $pass = $_[0] !~ /$expected/; + unless ($pass) { + $error = "# got '$_[0]'\n# expected !~ /$expected/"; + } + _ok($pass, $name, $error); +} sub eval_ok ($;$) { my ($code, $name) = @_;