summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/hs_tests.h17
-rw-r--r--src/tests/tests_main.c1
2 files changed, 14 insertions, 4 deletions
diff --git a/src/tests/hs_tests.h b/src/tests/hs_tests.h
index 23d480a..e619f7c 100644
--- a/src/tests/hs_tests.h
+++ b/src/tests/hs_tests.h
@@ -11,9 +11,17 @@
#include "../honeysuckle.h"
#include "colors.h"
+#define STR_IMPL(x) #x
+#define STR(x) STR_IMPL(x)
+
+#define mu_indent " "
+
/* minunit testing macros modified from those at
www.jera.com/techinfo/jtns/jtn002.html */
-#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
+#define mu_assert(message, test) do { \
+ if (!(test)) return message \
+ "\n" mu_indent " [" __FILE__ ":" STR(__LINE__) "]"; \
+ } while (0)
#define mu_run_test(name, test) do { \
lua_State *L = luaL_newstate(); \
luaL_openlibs(L); \
@@ -21,14 +29,15 @@
lua_close(L); \
tests_run++; \
if (message) { \
- printf(RED " test '%s' failed: %s\n" RESET, name, message); \
+ printf(RED mu_indent "test '%s' failed: %s\n" RESET, name, message); \
tests_failed++; \
} \
} while (0)
-
+#define mu_suite_start() tests_run_old = tests_run;
+#define mu_suite_finish() printf(mu_indent "ran %d tests\n", tests_run - tests_run_old);
#define TEST(name) static const char* name(lua_State *L)
-extern int tests_run, tests_failed;
+extern int tests_run, tests_run_old, tests_failed;
void hs_type_to_string_tests();
void hs_parse_args_tests();
diff --git a/src/tests/tests_main.c b/src/tests/tests_main.c
index 51c2462..84de599 100644
--- a/src/tests/tests_main.c
+++ b/src/tests/tests_main.c
@@ -8,6 +8,7 @@
*/
int tests_run = 0;
+int tests_run_old = 0;
int tests_failed = 0;
int main()