From 7f9c01a9bb54a53558ade16f31544403c7ed773d Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 9 Jul 2022 14:33:38 +0000 Subject: [PATCH] Fix a test leak. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3922 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/taskstub.js.c | 1 + src/tests.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/taskstub.js.c b/src/taskstub.js.c index 5fe2f08c..3c7f7cd7 100644 --- a/src/taskstub.js.c +++ b/src/taskstub.js.c @@ -253,6 +253,7 @@ static void _taskstub_cleanup(tf_taskstub_t* stub) static void _taskstub_finalizer(JSRuntime* runtime, JSValue value) { tf_taskstub_t* stub = JS_GetOpaque(value, _classId); + stub->_object = JS_UNDEFINED; JSContext* context = tf_task_get_context(stub->_owner); if (!JS_IsUndefined(stub->_on_exit)) { diff --git a/src/tests.c b/src/tests.c index 44c825ae..897fcce1 100644 --- a/src/tests.c +++ b/src/tests.c @@ -606,9 +606,13 @@ static void _tf_test_run(const tf_test_options_t* options, const char* name, voi if (!options->tests || specified) { - printf("Running test %s.\n", name); +#define GREEN "[\e[1;32m" +#define MAGENTA "\e[1;35m" +#define CYAN "\e[1;36m" +#define RESET "\e[0m" + printf(CYAN "== running test " MAGENTA "%s" CYAN " ==\n" RESET, name); test(options); - printf("[\e[1;32mpass\e[0m] %s\n", name); + printf("[" GREEN "pass" RESET "] %s\n", name); } }