Add test to improve coverage of CheckIO::checkWrongPrintfScanfArguments()
This commit is contained in:
parent
ccba934cb1
commit
1d78d74175
|
@ -1948,6 +1948,14 @@ private:
|
||||||
check(code, false, false, Settings::Win64);
|
check(code, false, false, Settings::Win64);
|
||||||
ASSERT_EQUALS(result_win64, errout.str());
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
check("void g() {\n"
|
||||||
|
" const char c[]=\"42\";\n"
|
||||||
|
" scanf(\"%s\n\", c);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:3]: (warning) %s in format string (no. 1) requires a 'char *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:3]: (warning) scanf without field width limits can crash with huge input data.\n", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue