You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testio.cpp
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -773,6 +773,7 @@ class TestIO : public TestFixture {
773
773
" {\n"
774
774
" char line[100];\n"
775
775
" fgets(line, sizeof(line), fp);\n"
776
+
" dostuff(line);\n"
776
777
" }\n"
777
778
"}");
778
779
ASSERT_EQUALS("[test.cpp:2:10]: (warning) Using feof() as a loop condition causes the last line to be processed twice. [wrongfeofUsage]\n", errout_str());
@@ -795,6 +796,24 @@ class TestIO : public TestFixture {
795
796
" }\n"
796
797
"}");
797
798
ASSERT_EQUALS("", errout_str());
799
+
800
+
check("void foo(FILE *fp) {\n"
801
+
" char line[100];\n"
802
+
" do {\n"
803
+
" fgets(line, sizeof(line), fp);\n"
804
+
" dostuff(line);\n"
805
+
" } while (!feof(fp));\n"
806
+
"}");
807
+
ASSERT_EQUALS("[test.cpp:6:12]: (warning) Using feof() as a loop condition causes the last line to be processed twice. [wrongfeofUsage]\n", errout_str());
0 commit comments