Skip to content

Commit 9f7c342

Browse files
committed
Added a regression test for ticket #10000 - No UnreadVariable for simple class
1 parent 8ce0faf commit 9f7c342

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/testunusedvar.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5836,6 +5836,29 @@ class TestUnusedVar : public TestFixture {
58365836
"}");
58375837
ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: c\n", errout.str());
58385838

5839+
functionVariableUsage("class ExampleClass\n" // #10000
5840+
"{\n"
5841+
"public:\n"
5842+
" ExampleClass(int xScale, int yScale, int x, int y)\n"
5843+
" : XScale(xScale)\n"
5844+
" , YScale(yScale)\n"
5845+
" , X(x)\n"
5846+
" , Y(y)\n"
5847+
" {\n"
5848+
" }\n"
5849+
" \n"
5850+
" int XScale;\n"
5851+
" int YScale;\n"
5852+
" int X;\n"
5853+
" int Y;\n"
5854+
"};\n"
5855+
" \n"
5856+
"void foo()\n"
5857+
"{\n"
5858+
" ExampleClass ex(1, 2, 3, 4);\n"
5859+
"}");
5860+
ASSERT_EQUALS("[test.cpp:20]: (style) Variable 'ex' is assigned a value that is never used.\n", errout.str());
5861+
58395862
functionVariableUsage("class C { public: C(int); ~C(); };\n"
58405863
"void f() {\n"
58415864
" C c(12);\n"

0 commit comments

Comments
 (0)