Improve test coverage for detecting wrong file mode

This commit is contained in:
Dmitry-Me 2017-10-03 18:25:15 +03:00
parent 0d888ba82d
commit 9564442167
1 changed files with 12 additions and 0 deletions

View File

@ -251,6 +251,12 @@ private:
"}", false, false, Settings::Win32W); "}", false, false, Settings::Win32W);
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo(FILE*& f) {\n"
" f = tmpfile();\n"
" fwrite(buffer, 5, 6, f);\n"
"}", false, false, Settings::Win32W);
ASSERT_EQUALS("", errout.str());
// Write mode // Write mode
check("void foo(FILE*& f) {\n" check("void foo(FILE*& f) {\n"
" f = fopen(name, \"w\");\n" " f = fopen(name, \"w\");\n"
@ -266,6 +272,12 @@ private:
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo(FILE*& f) {\n"
" f = tmpfile();\n"
" fread(buffer, 5, 6, f);\n"
"}");
ASSERT_EQUALS("", errout.str());
// Append mode // Append mode
check("void foo(FILE*& f) {\n" check("void foo(FILE*& f) {\n"
" f = fopen(name, \"a\");\n" " f = fopen(name, \"a\");\n"