summaryrefslogtreecommitdiff
path: root/libparted/tests/common.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2007-04-19 21:30:53 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2007-04-19 21:30:53 -0300
commitcba3a64fb1744f545c373594c8795a4da30558c4 (patch)
treefd40e767f50e5cf6bf6c5dc2f5577e9a9bda4400 /libparted/tests/common.c
parenta46cc7578fd2ff478b6e83850e06b73fe42911b1 (diff)
downloadparted-cba3a64fb1744f545c373594c8795a4da30558c4.tar.gz
[tests] Add _test_exception_handler to fail every time an exception is raised
Sometimes parts of code raises exceptions and this shouldn't happen on tests. To ensure we catch them a specific exception handler has been implemented. The handler usage is very easy. You just need to put the following code at testsuite main method: ... /* Fail when an exception is raised */ ped_exception_set_handler (_test_exception_handler); ... Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'libparted/tests/common.c')
-rw-r--r--libparted/tests/common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libparted/tests/common.c b/libparted/tests/common.c
index ab2c0ac..e7ce56f 100644
--- a/libparted/tests/common.c
+++ b/libparted/tests/common.c
@@ -8,6 +8,16 @@
#include "common.h"
+PedExceptionOption
+_test_exception_handler (PedException* e)
+{
+ fail ("Exception of type %s has been raised: %s",
+ ped_exception_get_type_string (e->type),
+ e->message);
+
+ return PED_EXCEPTION_UNHANDLED;
+}
+
char*
_create_disk (const off_t size)
{