From 9b9a0de77704ff8d13ff9cf3111b908cfda87baa Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Mon, 1 Aug 2011 06:45:06 -0400 Subject: [PATCH] add test for #2937 (Scope::checkVariable found variable 'sMMF' with varid 0.) --- test/testtokenize.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 6ea2e8685..06fd80ac8 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -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"