Skip to content

Commit

Permalink
Add tests for #9822/#9823
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Dec 8, 2023
1 parent 4538002 commit 6912ecb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/testunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6574,6 +6574,25 @@ class TestUnusedVar : public TestFixture {
" return 0;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) Unused variable: a\n", errout.str());

functionVariableUsage("void f() {\n" // #9823
" auto cb = []() {\n"
" int i;\n"
" };\n"
" (void)cb;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());

functionVariableUsage("void f() {\n" // #9822
" int i;\n"
" auto cb = []() {\n"
" int i;\n"
" };\n"
" (void)cb;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) Unused variable: i\n"
"[test.cpp:4]: (style) Unused variable: i\n",
errout.str());
}


Expand Down

0 comments on commit 6912ecb

Please sign in to comment.