add test for #2937 (Scope::checkVariable found variable 'sMMF' with varid 0.)

This commit is contained in:
Robert Reif 2011-08-01 06:45:06 -04:00
parent 207038a087
commit 9b9a0de777
1 changed files with 20 additions and 0 deletions

View File

@ -180,6 +180,7 @@ private:
TEST_CASE(varid32); // ticket #2835 (segmentation fault)
TEST_CASE(varid33); // ticket #2875 (segmentation fault)
TEST_CASE(varid34); // ticket #2825
TEST_CASE(varid35); // ticket #2937
TEST_CASE(varidFunctionCall1);
TEST_CASE(varidFunctionCall2);
TEST_CASE(varidFunctionCall3);
@ -2994,6 +2995,25 @@ private:
ASSERT_EQUALS("", errout.str());
}
void varid35() // ticket #2937
{
const std::string code("int foo() {\n"
" int f(x);\n"
" return f;\n"
"}\n");
const std::string expected("\n\n##file 0\n"
"1: int foo ( ) {\n"
"2: int f@1 ( x ) ;\n"
"3: return f@1 ;\n"
"4: }\n");
const std::string actual("\n\n##file 0\n"
"1: int foo ( ) {\n"
"2: int f ( x ) ;\n"
"3: return f ;\n"
"4: }\n");
TODO_ASSERT_EQUALS(expected, actual, tokenizeDebugListing(code));
}
void varidFunctionCall1()
{
const std::string code("void f() {\n"