You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-commits@perl.apache.org by ge...@apache.org on 2006/02/13 15:34:09 UTC
svn commit: r377386 - /perl/Apache-Test/trunk/lib/Apache/TestConfigPHP.pm
Author: geoff
Date: Mon Feb 13 06:34:07 2006
New Revision: 377386
URL: http://svn.apache.org/viewcvs?rev=377386&view=rev
Log:
updates to test-more.php from chris, based on our
apachecon late night sessions
Modified:
perl/Apache-Test/trunk/lib/Apache/TestConfigPHP.pm
Modified: perl/Apache-Test/trunk/lib/Apache/TestConfigPHP.pm
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/lib/Apache/TestConfigPHP.pm?rev=377386&r1=377385&r2=377386&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestConfigPHP.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestConfigPHP.pm Mon Feb 13 06:34:07 2006
@@ -425,8 +425,8 @@
* PROJECT INFORMATION *
* *
* Project: Apache-Test *
-* URL: http://httpd.apache.org/test/ *
-* Notice: Copyright (c) 2004 The Apache Software Foundation *
+* URL: http://perl.apache.org/Apache-Test/ *
+* Notice: Copyright (c) 2006 The Apache Software Foundation *
* *
*********************************************************************
* LICENSE INFORMATION *
@@ -456,24 +456,26 @@
* Originally inspired by work from Andy Lester. Written and *
* maintained by Chris Shiflett. For contact information, see: *
* *
-* http://shiflett.org/contact *
+* http://shiflett.org/ *
* *
\*******************************************************************/
header('Content-Type: text/plain');
register_shutdown_function('_test_end');
-$_no_plan = false;
+$_no_plan = FALSE;
$_num_failures = 0;
$_num_skips = 0;
$_test_num = 0;
function plan($plan)
{
- # plan('no_plan');
- # plan('skip_all');
- # plan(array('skip_all' => 'My reason is...'));
- # plan(23);
+ /*
+ plan('no_plan');
+ plan('skip_all');
+ plan(array('skip_all' => 'My reason is...'));
+ plan(23);
+ */
global $_no_plan;
global $_skip_all;
@@ -482,12 +484,11 @@
switch ($plan)
{
case 'no_plan':
- $_no_plan = true;
+ $_no_plan = TRUE;
break;
case 'skip_all':
echo "1..0\n";
- exit;
break;
default:
@@ -513,10 +514,10 @@
if ($_num_skips)
{
$_num_skips--;
- return true;
+ return TRUE;
}
- if (!empty($test_name))
+ if (!empty($test_name) && $test_name[0] != '#')
{
$test_name = "- $test_name";
}
@@ -554,6 +555,7 @@
function is($this, $that, $test_name = '')
{
$pass = ($this == $that);
+
ok($pass, $test_name);
if (!$pass)
@@ -568,41 +570,44 @@
function isnt($this, $that, $test_name = '')
{
$pass = ($this != $that);
+
ok($pass, $test_name);
if (!$pass)
{
diag(" '$this'");
- diag(" !=");
+ diag(' !=');
diag(" '$that'");
}
return $pass;
}
-function like($string, $regex, $test_name = '')
+function like($string, $pattern, $test_name = '')
{
- $pass = preg_match($regex, $string);
+ $pass = preg_match($pattern, $string);
+
ok($pass, $test_name);
if (!$pass)
{
diag(" '$string'");
- diag(" doesn't match '$regex'");
+ diag(" doesn't match '$pattern'");
}
return $pass;
}
-function unlike($string, $regex, $test_name = '')
+function unlike($string, $pattern, $test_name = '')
{
- $pass = !preg_match($regex, $string);
+ $pass = !preg_match($pattern, $string);
+
ok($pass, $test_name);
if (!$pass)
{
diag(" '$string'");
- diag(" matches '$regex'");
+ diag(" matches '$pattern'");
}
return $pass;
@@ -610,7 +615,8 @@
function cmp_ok($this, $operator, $that, $test_name = '')
{
- eval('$pass = ($this ' . $operator . ' $that);');
+ eval("\$pass = (\$this $operator \$that);");
+
ok($pass, $test_name);
if (!$pass)
@@ -624,25 +630,25 @@
function can_ok($object, $methods)
{
- $pass = true;
+ $pass = TRUE;
$errors = array();
foreach ($methods as $method)
{
if (!method_exists($object, $method))
{
- $pass = false;
+ $pass = FALSE;
$errors[] = " method_exists(\$object, $method) failed";
}
}
if ($pass)
{
- ok(true, "method_exists(\$object, ...)");
+ ok(TRUE, "method_exists(\$object, ...)");
}
else
{
- ok(false, "method_exists(\$object, ...)");
+ ok(FALSE, "method_exists(\$object, ...)");
diag($errors);
}
@@ -664,11 +670,11 @@
if ($pass)
{
- ok(true, "$object_name isa $expected_class");
+ ok(TRUE, "$object_name isa $expected_class");
}
else
{
- ok(false, "$object_name isn't a '$expected_class' it's a '$got_class'");
+ ok(FALSE, "$object_name isn't a '$expected_class' it's a '$got_class'");
}
return $pass;
@@ -676,12 +682,12 @@
function pass($test_name = '')
{
- return ok(true, $test_name);
+ return ok(TRUE, $test_name);
}
function fail($test_name = '')
{
- return ok(false, $test_name);
+ return ok(FALSE, $test_name);
}
function diag($message)
@@ -722,36 +728,41 @@
for ($i = 0; $i < $num; $i++)
{
- # FIXME: The pound sign should replace the hyphen
pass("# SKIP $message");
}
$_num_skips = $num;
}
-# function todo()
-# {
-# }
-
-# function todo_skip()
-# {
-# }
-
-# function is_deeply()
-# {
-# }
-
-# function eq_array()
-# {
-# }
-
-# function eq_hash()
-# {
-# }
-
-# function eq_set()
-# {
-# }
+/*
+
+TODO:
+
+function todo()
+{
+}
+
+function todo_skip()
+{
+}
+
+function is_deeply()
+{
+}
+
+function eq_array()
+{
+}
+
+function eq_hash()
+{
+}
+
+function eq_set()
+{
+}
+
+*/
function _test_end()
{
@@ -769,4 +780,5 @@
diag("Looks like you failed $_num_failures tests of $_test_num.");
}
}
+
?>