#2553 added testcase

This commit is contained in:
Ettl Martin 2012-07-24 15:54:38 +02:00
parent e6f761126c
commit a6c54563ae
1 changed files with 11 additions and 0 deletions

View File

@ -42,6 +42,7 @@ private:
TEST_CASE(testScanf1); // Scanf without field limiters
TEST_CASE(testScanf2);
TEST_CASE(testScanf3);
TEST_CASE(testScanf4); // #ticket 2553
TEST_CASE(testScanfArgument);
TEST_CASE(testPrintfArgument);
@ -399,6 +400,16 @@ private:
ASSERT_EQUALS("", errout.str());
}
void testScanf4() { // ticket #2553
check("void f()\n"
"{\n"
" char str [8];\n"
" scanf (\"%70s\",str);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Width 70 given in format string (no. 1) is larger than destination buffer 'str[8]', use %7s to prevent overflowing it.\n", errout.str());
}