Skip to content

Commit b4cc459

Browse files
author
Ludvig Gunne Lindström
committed
remove includes from test code
1 parent 4294ed8 commit b4cc459

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/testleakautovar.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ class TestLeakAutoVar : public TestFixture {
638638

639639
void memcpyWithPtr1() { // #11542
640640
const Settings s = settingsBuilder().library("std.cfg").library("posix.cfg").build();
641-
check("#include <string.h>\n"
642-
"void f(char** old, char* value) {\n"
641+
check("void f(char** old, char* value) {\n"
643642
" char *str = strdup(value);\n"
644643
" memcpy(old, &str, sizeof(char*));\n"
645644
"}\n", &s);
@@ -648,14 +647,12 @@ class TestLeakAutoVar : public TestFixture {
648647

649648
void memcpyWithPtr2() {
650649
const Settings s = settingsBuilder().library("std.cfg").library("posix.cfg").build();
651-
check("#include <string.h>\n"
652-
"void f(char* value) {\n"
650+
check("void f(char* value) {\n"
653651
" char *old = NULL;\n"
654652
" char *str = strdup(value);\n"
655653
" memcpy(&old, &str, sizeof(char*));\n"
656654
"}\n", &s);
657-
// TODO: make this fail
658-
ASSERT_EQUALS("", errout_str());
655+
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: old\n", errout_str());
659656
}
660657

661658
void isAutoDealloc() {

0 commit comments

Comments
 (0)