Skip to content

Commit

Permalink
Nette\Test: added tag for HEX digits; better exception dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 9, 2012
1 parent aed772f commit c0e6721
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tester/NetteTestCase.php
Expand Up @@ -284,6 +284,7 @@ public static function compare($left, $right)
'%d?%'=> '[0-9]*', // zero or more digits
'%i%' => '[+-]?[0-9]+', // signed integer value
'%f%' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', // floating point number
'%h%' => '[0-9a-fA-F]+',// one or more HEX digits
'%[^' => '[^', // reg-exp
'%[' => '[', // reg-exp
']%' => ']+', // reg-exp
Expand Down
1 change: 1 addition & 0 deletions Tester/conventions.txt
Expand Up @@ -44,6 +44,7 @@ PHP (All test cases are valid PHP files)
%d?% zero or more digits
%i% signed integer value
%f% floating point number
%h% one or more HEX digits
%[..]% reg-exp


Expand Down
3 changes: 3 additions & 0 deletions Tester/initialize.php
Expand Up @@ -203,6 +203,9 @@ public static function dump(& $var, $level = 0)
}
echo "\n";

} elseif ($var instanceof Exception) {
echo 'Exception ', get_class($var), ': ', ($var->getCode() ? '#' . $var->getCode() . ' ' : '') . $var->getMessage(), "\n";

} elseif (is_object($var)) {
$arr = (array) $var;
echo "object(" . get_class($var) . ") (" . count($arr) . ") ";
Expand Down

0 comments on commit c0e6721

Please sign in to comment.