summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-04-13 20:57:34 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-04-13 20:57:34 +0200
commitc1dee726d51d3dea0d4e5d481b54279a0c7f82c3 (patch)
tree1704f413b31f2adea619008650c9801d5d21ac90 /tests/scripts
parent3c97a1abae880c7be29d638a5f6b2fc4968364f3 (diff)
downloadweechat-c1dee726d51d3dea0d4e5d481b54279a0c7f82c3.zip
tests: turn off memory leak detection only when testing javascript API
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/test-scripts.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/scripts/test-scripts.cpp b/tests/scripts/test-scripts.cpp
index 8f325bca1..817d97320 100644
--- a/tests/scripts/test-scripts.cpp
+++ b/tests/scripts/test-scripts.cpp
@@ -97,12 +97,6 @@ TEST_GROUP(Scripts)
void setup()
{
- /*
- * TODO: fix memory leaks in javascript plugin
- * and keep memory leak detection enabled
- */
- MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
-
api_hook_print = hook_print (NULL, /* plugin */
NULL, /* buffer */
NULL, /* tags */
@@ -116,12 +110,6 @@ TEST_GROUP(Scripts)
void teardown()
{
unhook (api_hook_print);
-
- /*
- * TODO: fix memory leaks in javascript plugin
- * and keep memory leak detection enabled
- */
- MemoryLeakWarningPlugin::turnOnNewDeleteOverloads();
}
};
@@ -148,7 +136,7 @@ TEST(Scripts, API)
{ "php", "php" },
{ NULL, NULL }
};
- int i;
+ int i, turnoff_memleak;
printf ("...\n");
@@ -198,6 +186,15 @@ TEST(Scripts, API)
/* test the scripting API */
for (i = 0; languages[i][0]; i++)
{
+ /*
+ * TODO: fix memory leaks in javascript plugin
+ * and keep memory leak detection enabled
+ */
+ turnoff_memleak = (strcmp (languages[i][0], "javascript") == 0);
+
+ if (turnoff_memleak)
+ MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
+
api_tests_ok = 0;
api_tests_errors = 0;
api_tests_count = 0;
@@ -260,6 +257,9 @@ TEST(Scripts, API)
* and 2 messages when it is unloaded, so total is 4)
*/
LONGS_EQUAL(0, api_tests_other);
+
+ if (turnoff_memleak)
+ MemoryLeakWarningPlugin::turnOnNewDeleteOverloads();
}
free (path_testapi_output_dir);