TestUninitVar: moved out posix.cfg testing

This commit is contained in:
Daniel Marjamäki 2015-02-17 18:16:29 +01:00
parent d900148e6b
commit 6363c1359d
2 changed files with 10 additions and 17 deletions

View File

@ -125,3 +125,13 @@ void uninitvar(int fd) {
// cppcheck-suppress uninitvar
write(fd,"ab",x);
}
void uninitvar_types(void) {
blkcnt_t b;
// cppcheck-suppress uninitvar
return b;
dirent d;
// cppcheck-suppress uninitvar
return d.d_ino;
}

View File

@ -75,8 +75,6 @@ private:
TEST_CASE(syntax_error); // Ticket #5073
TEST_CASE(uninitvar_posix_types);
// dead pointer
TEST_CASE(deadPointer);
}
@ -3915,21 +3913,6 @@ private:
"}");
ASSERT_EQUALS("[test.cpp:7]: (error) Dead pointer usage. Pointer 'former_hover' is dead if it has been assigned '&item' at line 5.\n", errout.str());
}
void uninitvar_posix_types() {
checkUninitVarB("blkcnt_t* f() {blkcnt_t *b; return b;}");
ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: b\n", errout.str());
checkUninitVarB("blkcnt_t f() {blkcnt_t b; return b;}");
ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: b\n", errout.str());
// dirent
checkUninitVarB("char f() { dirent d; return d.d_name[0]; }");
ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: d\n", errout.str());
checkUninitVarB("ino_t f2() { dirent d; return d.d_ino; }");
ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: d\n", errout.str());
}
};
REGISTER_TEST(TestUninitVar)