The `testMultipleCollection` test case was allocating a
ListenerCollection without deleting it. The helper function
`countCommands` was not deleting the `Command`s returned from
`InteractiveShell::readCommand`. In the `testEmptyFileInput` and
`testSimpleFileInput` tests, the `filename` string was not deleted. This
commit fixes all issues.
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 );
}
remove(filename);
// mkfifo(ptr, S_IWUSR | s_IRUSR);
+ delete filename;
}
void testSimpleFileInput() {
);
remove(filename);
+ delete filename;
}
void testEmptyStringInput() {
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() {