Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: php-4.1.0RC2
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (30 sloc) 0.808 kb
<?php
/*
Helper for simple tests to check return-value. Usage:
$tests = <<<TESTS
expected_return_value === expression
2 === 1+1
4 === 2*2
FALSE === @ fopen('non_existent_file')
TESTS;
include( '../../../(../)tests/quicktester.inc' );
Expect: OK
Remember to NOT put a trailing ; after a line!
*/
error_reporting(E_ALL);
$tests = explode("\n",$tests);
$success = TRUE;
foreach ($tests as $test)
{
$res = eval("return ($test);");
$success = $success && $res;
if (!$res)
{
echo "\nAssert failed:\n";
echo "$test\n";
list($left,$right) = explode('===',$test);
echo "Left: ";var_dump(eval("return ($left );"));
echo "Right: ";var_dump(eval("return ($right);"));
}
}
if ($success) echo "OK";
Jump to Line
Something went wrong with that request. Please try again.