testunusedvar: move UB testcase to testuninitvar
This commit is contained in:
parent
ffac1d1b00
commit
56bc5536aa
|
@ -1480,6 +1480,15 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// Passing array to function
|
||||||
|
checkUninitVar("void f(int i);\n"
|
||||||
|
"void foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" int a[10];\n"
|
||||||
|
" f(a[0]);\n"
|
||||||
|
"}");
|
||||||
|
TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Uninitialized variable: a\n", "", errout.str());
|
||||||
|
|
||||||
// Ticket #2320
|
// Ticket #2320
|
||||||
checkUninitVar("void foo() {\n"
|
checkUninitVar("void foo() {\n"
|
||||||
" char a[2];\n"
|
" char a[2];\n"
|
||||||
|
|
|
@ -2111,16 +2111,6 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// f() can not write a (not supported yet)
|
|
||||||
functionVariableUsage("void f(int i) { }\n"
|
|
||||||
"void foo()\n"
|
|
||||||
"{\n"
|
|
||||||
" int a[10];\n"
|
|
||||||
" f(a[0]);\n"
|
|
||||||
"}");
|
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is not assigned a value.\n",
|
|
||||||
"", errout.str());
|
|
||||||
|
|
||||||
// f() can not write a (not supported yet)
|
// f() can not write a (not supported yet)
|
||||||
functionVariableUsage("void f(const int & i) { }\n"
|
functionVariableUsage("void f(const int & i) { }\n"
|
||||||
"void foo()\n"
|
"void foo()\n"
|
||||||
|
|
Loading…
Reference in New Issue