Improve test coverage for %c used with scanf_s

This commit is contained in:
Dmitry-Me 2017-10-13 19:08:14 +03:00
parent d32a8884bf
commit b678f3c4c4
1 changed files with 7 additions and 0 deletions

View File

@ -3126,6 +3126,13 @@ private:
"[test.cpp:5]: (warning) %u in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'.\n"
"[test.cpp:5]: (warning) wscanf_s format string requires 6 parameters but 7 are given.\n", errout.str());
check("void f() {\n"
" char str[8];\n"
" scanf_s(\"%8c\", str, sizeof(str))\n"
" scanf_s(\"%9c\", str, sizeof(str))\n"
"}\n", false, false, Settings::Win32A);
ASSERT_EQUALS("[test.cpp:4]: (error) Width 9 given in format string (no. 1) is larger than destination buffer 'str[8]', use %8c to prevent overflowing it.\n", errout.str());
check("void foo() {\n"
" TCHAR txt[100];\n"
" int i;\n"