summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Barrett <barrett@cs.stanford.edu>2016-11-05 07:39:09 -0700
committerGitHub <noreply@github.com>2016-11-05 07:39:09 -0700
commit4961abfa9bec88a2e15fc3078e2bd8a5bb258f93 (patch)
tree728523b4689a1576c23c4895f175a34e46461c4c
parent44d49562a5a9d98e818aabc2943a84630560c8ed (diff)
parentc08aa1d05429ad0a293d708236d6d29afd3d02cc (diff)
Merge pull request #101 from 4tXJ7f/fix_leak
Fix three leaks in unit tests
-rw-r--r--test/unit/main/interactive_shell_black.h6
-rw-r--r--test/unit/parser/parser_builder_black.h2
-rw-r--r--test/unit/util/listener_black.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/test/unit/main/interactive_shell_black.h b/test/unit/main/interactive_shell_black.h
index f1fce3cb8..9ac81781c 100644
--- a/test/unit/main/interactive_shell_black.h
+++ b/test/unit/main/interactive_shell_black.h
@@ -47,8 +47,12 @@ private:
void countCommands(InteractiveShell& shell,
int minCommands,
int maxCommands) {
+ Command* cmd;
int n = 0;
- while( n <= maxCommands && shell.readCommand() != NULL ) { ++n; }
+ while( n <= maxCommands && (cmd = shell.readCommand()) != NULL ) {
+ ++n;
+ delete cmd;
+ }
TS_ASSERT( n <= maxCommands );
TS_ASSERT( n >= minCommands );
}
diff --git a/test/unit/parser/parser_builder_black.h b/test/unit/parser/parser_builder_black.h
index 42ebc2cf9..61c426be9 100644
--- a/test/unit/parser/parser_builder_black.h
+++ b/test/unit/parser/parser_builder_black.h
@@ -99,6 +99,7 @@ public:
remove(filename);
// mkfifo(ptr, S_IWUSR | s_IRUSR);
+ delete filename;
}
void testSimpleFileInput() {
@@ -114,6 +115,7 @@ public:
);
remove(filename);
+ delete filename;
}
void testEmptyStringInput() {
diff --git a/test/unit/util/listener_black.h b/test/unit/util/listener_black.h
index 5319eacd1..b9ce7a3f7 100644
--- a/test/unit/util/listener_black.h
+++ b/test/unit/util/listener_black.h
@@ -100,6 +100,7 @@ public:
TS_ASSERT(collection->empty());
std::string expected[4] = {"a", "b", "c", "c"};
TS_ASSERT_EQUALS(d_events, mkMultiset(expected, 4));
+ TS_ASSERT_THROWS_NOTHING( delete collection );
}
void testRegisterMiddleTearDown() {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback