[prev in list] [next in list] [prev in thread] [next in thread]
List: kolab-commits
Subject: src/php
From: Thomas_BrĂ¼derli <bruederli () kolabsys ! com>
Date: 2013-01-30 15:40:16
Message-ID: 20130130154016.4F3CC1FBA9D () app01 ! kolabsys ! com
[Download RAW message or body]
src/php/test.php | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
New commits:
commit f359eca2f4bbca80ba035f5f7e9b1fa0737099b4
Author: Thomas Bruederli <bruederli@kolabsys.com>
Date: Wed Jan 30 16:12:48 2013 +0100
Add exit status to bingings test script
diff --git a/src/php/test.php b/src/php/test.php
index 207ccff..3e4f28f 100755
--- a/src/php/test.php
+++ b/src/php/test.php
@@ -1,14 +1,23 @@
<?php
-//run using "php -d enable_dl=On -d extension=./kolabformat.so test.php"
+//run using "php -d enable_dl=On -d extension=./kolabformat.so test.php [--verbose]"
include("kolabformat.php");
+/////// Basic unit test facilities
+
+$errors = 0;
+$verbose = preg_match('/\s(--verbose|-v)\b/', join(' ', $_SERVER['argv']));
+
function assertequal($got, $expect, $name) {
+ global $verbose, $errors;
+
if ($got == $expect) {
- print "OK - $name\n";
+ if ($verbose)
+ print "OK - $name\n";
return true;
}
else {
+ $errors++;
print "FAIL - $name\n";
print "-- Expected " . var_export($expect, true) . ", got " . var_export($got, true) . " --\n";
return false;
@@ -31,6 +40,7 @@ function assertfalse($arg, $name) {
return assertequal($arg, false, $name);
}
+// utility to quickly convert PHP arrays into a vector
function array2vector($arr) {
$vec = new vectors;
foreach ((array)$arr as $val)
@@ -217,7 +227,6 @@ $c3 = kolabformat::readConfiguration($xml, false);
asserttrue($c2->uid() != $c3->uid(), "Generate different UIDs for configuration objects");
-?>
-
-
+// terminate with error status
+exit($errors);
_______________________________________________
kolab-commits mailing list
kolab-commits@kolab.org
https://www.intevation.de/mailman/listinfo/kolab-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic