Update clar to 587f88a
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/tests/clar.c b/tests/clar.c
index 5354241..8e538f5 100644
--- a/tests/clar.c
+++ b/tests/clar.c
@@ -353,8 +353,8 @@ clar_parse_args(int argc, char **argv)
}
}
-int
-clar_test(int argc, char **argv)
+void
+clar_test_init(int argc, char **argv)
{
clar_print_init(
(int)_clar_callback_count,
@@ -369,13 +369,23 @@ clar_test(int argc, char **argv)
if (argc > 1)
clar_parse_args(argc, argv);
+}
+int
+clar_test_run()
+{
if (!_clar.suites_ran) {
size_t i;
for (i = 0; i < _clar_suite_count; ++i)
clar_run_suite(&_clar_suites[i], NULL);
}
+ return _clar.total_errors;
+}
+
+void
+clar_test_shutdown()
+{
clar_print_shutdown(
_clar.tests_ran,
(int)_clar_suite_count,
@@ -383,7 +393,18 @@ clar_test(int argc, char **argv)
);
clar_unsandbox();
- return _clar.total_errors;
+}
+
+int
+clar_test(int argc, char **argv)
+{
+ int errors;
+
+ clar_test_init(argc, argv);
+ errors = clar_test_run();
+ clar_test_shutdown();
+
+ return errors;
}
void clar__fail(
diff --git a/tests/clar.h b/tests/clar.h
index 87ff6d9..8126305 100644
--- a/tests/clar.h
+++ b/tests/clar.h
@@ -9,8 +9,14 @@
#include <stdlib.h>
+void clar_test_init(int argc, char *argv[]);
+int clar_test_run(void);
+void clar_test_shutdown(void);
+
int clar_test(int argc, char *argv[]);
+const char *clar_sandbox_path(void);
+
void cl_set_cleanup(void (*cleanup)(void *), void *opaque);
void cl_fs_cleanup(void);
diff --git a/tests/clar/sandbox.h b/tests/clar/sandbox.h
index ee75641..a44e291 100644
--- a/tests/clar/sandbox.h
+++ b/tests/clar/sandbox.h
@@ -127,3 +127,8 @@ static int clar_sandbox(void)
return 0;
}
+const char *clar_sandbox_path(void)
+{
+ return _clar_path;
+}
+