Fixed #2526 (Make TODO_ASSERT_EQUALS take three arguments (value, to_be, as_is)?...
Removed replaced EXPECTED with... WANTED (to-be): The future expected value. CURRENT (as-is): Documenting how cppcheck behaves now. This removes the need for an ASSERT_EQUALS but enforces the check for every TODO_ASSERT_EQUALS.
This commit is contained in:
parent
8b6694f32a
commit
098f0bf3e6
|
@ -561,8 +561,8 @@ private:
|
|||
" char str[5];\n"
|
||||
" memclr( 10, str ); // ERROR\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (possible error) Array index out of bounds\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str()); // current result
|
||||
TODO_ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (possible error) Array index out of bounds\n",
|
||||
"", errout.str());
|
||||
|
||||
// This is not an error
|
||||
check("static void memclr( char *data, int size )\n"
|
||||
|
@ -610,8 +610,8 @@ private:
|
|||
"{\n"
|
||||
" memclr(abc->str);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:13] -> [test.cpp:8]: (possible error) Array index out of bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:13] -> [test.cpp:8]: (possible error) Array index out of bounds\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -795,8 +795,7 @@ private:
|
|||
" i+=1;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str()); // Catch changes
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Buffer overrun\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Buffer overrun\n", "", errout.str());
|
||||
}
|
||||
|
||||
void array_index_19()
|
||||
|
@ -1001,8 +1000,7 @@ private:
|
|||
" int *ip = &i[1];\n"
|
||||
" ip[-10] = 1;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Array ip[-10] out of bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Array ip[-10] out of bounds\n", "", errout.str());
|
||||
}
|
||||
|
||||
void array_index_29()
|
||||
|
@ -1015,8 +1013,7 @@ private:
|
|||
" int *ii = &i[-5];"
|
||||
" ii[10] = 0;"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Array ii[10] out of bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Array ii[10] out of bounds\n", "", errout.str());
|
||||
}
|
||||
|
||||
void array_index_30()
|
||||
|
@ -1133,7 +1130,7 @@ private:
|
|||
" char a[10][10][10];\n"
|
||||
" a[2*3][4*3][2] = 'a';\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[10][10][10]' index a[6][12][2] out of bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[10][10][10]' index a[6][12][2] out of bounds\n", "", errout.str());
|
||||
|
||||
check("void f()\n"
|
||||
"{\n"
|
||||
|
@ -1201,8 +1198,7 @@ private:
|
|||
" };\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:12]: (error) Array index out of bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:12]: (error) Array index out of bounds\n", "", errout.str());
|
||||
}
|
||||
|
||||
void array_index_calculation()
|
||||
|
@ -1295,8 +1291,7 @@ private:
|
|||
" val[i+1] = val[i];\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Array 'val[5]' index -1 out of bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Array 'val[5]' index -1 out of bounds\n", "", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1562,8 +1557,7 @@ private:
|
|||
" char s[3];\n"
|
||||
" f1(s,3);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:8] -> [test.cpp:3]: (error) Buffer access out-of-bounds\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:8] -> [test.cpp:3]: (error) Buffer access out-of-bounds\n", "", errout.str());
|
||||
|
||||
check("void f1(char *s,int size)\n"
|
||||
"{\n"
|
||||
|
@ -1999,8 +1993,7 @@ private:
|
|||
" char buf[3];\n"
|
||||
" sprintf(buf, \"%s\", condition ? \"11\" : \"222\");\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", "", errout.str());
|
||||
}
|
||||
|
||||
void sprintf7()
|
||||
|
@ -2224,8 +2217,7 @@ private:
|
|||
" char a[5], b[50];\n"
|
||||
" memchr(a, b, 10);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", "", errout.str());
|
||||
}
|
||||
|
||||
// ticket #2121 - buffer access out of bounds when using uint32_t
|
||||
|
@ -2466,7 +2458,7 @@ private:
|
|||
ASSERT_EQUALS(9, CheckBufferOverrun::countSprintfLength("%08ld", intAsParameter));
|
||||
ASSERT_EQUALS(6, CheckBufferOverrun::countSprintfLength("%.2d", intAsParameter));
|
||||
ASSERT_EQUALS(9, CheckBufferOverrun::countSprintfLength("%08.2d", intAsParameter));
|
||||
TODO_ASSERT_EQUALS(5, CheckBufferOverrun::countSprintfLength("%x", intAsParameter));
|
||||
TODO_ASSERT_EQUALS(5, 2, CheckBufferOverrun::countSprintfLength("%x", intAsParameter));
|
||||
ASSERT_EQUALS(5, CheckBufferOverrun::countSprintfLength("%4x", intAsParameter));
|
||||
ASSERT_EQUALS(6, CheckBufferOverrun::countSprintfLength("%5x", intAsParameter));
|
||||
ASSERT_EQUALS(5, CheckBufferOverrun::countSprintfLength("%.4x", intAsParameter));
|
||||
|
@ -2478,17 +2470,17 @@ private:
|
|||
Token floatTok(0);
|
||||
floatTok.str("1.12345f");
|
||||
floatAsParameter.push_back(&floatTok);
|
||||
TODO_ASSERT_EQUALS(5, CheckBufferOverrun::countSprintfLength("%.2f", floatAsParameter));
|
||||
TODO_ASSERT_EQUALS(5, 3, CheckBufferOverrun::countSprintfLength("%.2f", floatAsParameter));
|
||||
ASSERT_EQUALS(9, CheckBufferOverrun::countSprintfLength("%8.2f", floatAsParameter));
|
||||
TODO_ASSERT_EQUALS(5, CheckBufferOverrun::countSprintfLength("%2.2f", floatAsParameter));
|
||||
TODO_ASSERT_EQUALS(5, 3, CheckBufferOverrun::countSprintfLength("%2.2f", floatAsParameter));
|
||||
|
||||
std::list<const Token*> floatAsParameter2;
|
||||
Token floatTok2(0);
|
||||
floatTok2.str("100.12345f");
|
||||
floatAsParameter2.push_back(&floatTok2);
|
||||
TODO_ASSERT_EQUALS(7, CheckBufferOverrun::countSprintfLength("%2.2f", floatAsParameter2));
|
||||
TODO_ASSERT_EQUALS(7, CheckBufferOverrun::countSprintfLength("%.2f", floatAsParameter));
|
||||
TODO_ASSERT_EQUALS(7, CheckBufferOverrun::countSprintfLength("%4.2f", floatAsParameter));
|
||||
TODO_ASSERT_EQUALS(7, 3, CheckBufferOverrun::countSprintfLength("%2.2f", floatAsParameter2));
|
||||
TODO_ASSERT_EQUALS(7, 3, CheckBufferOverrun::countSprintfLength("%.2f", floatAsParameter));
|
||||
TODO_ASSERT_EQUALS(7, 5, CheckBufferOverrun::countSprintfLength("%4.2f", floatAsParameter));
|
||||
|
||||
std::list<const Token*> multipleParams;
|
||||
multipleParams.push_back(&strTok);
|
||||
|
|
|
@ -1498,7 +1498,8 @@ private:
|
|||
"public:\n"
|
||||
" ~B() { int a; }\n"
|
||||
"};\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7]: (error) Class A which is inherited by class B does not have a virtual destructor\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7]: (error) Class A which is inherited by class B does not have a virtual destructor\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void virtualDestructorTemplate()
|
||||
|
@ -4303,7 +4304,8 @@ private:
|
|||
"std::vector<std::string> m_strVec;\n"
|
||||
"};\n"
|
||||
);
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetSize' can be const.\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (information) Technically the member function 'A::strGetSize' can be const.\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void const26() // ticket #1847
|
||||
|
@ -4625,8 +4627,8 @@ private:
|
|||
"}\n"
|
||||
"using namespace N;\n"
|
||||
"int Base::getResourceName() { return var; }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:6]: (information) Technically the member function 'N::Base::getResourceName' can be const.\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:6]: (information) Technically the member function 'N::Base::getResourceName' can be const.\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void const36() // ticket #2003
|
||||
|
@ -5076,7 +5078,8 @@ private:
|
|||
" A(){}\n"
|
||||
" unsigned int GetVecSize() {return m_v.size();}\n"
|
||||
"}");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7]: (information) Technically the member function 'A::GetVecSize' can be const.\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7]: (information) Technically the member function 'A::GetVecSize' can be const.\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void constVirtualFunc()
|
||||
|
|
|
@ -74,8 +74,8 @@ private:
|
|||
" unsigned int uvar = 2;\n"
|
||||
" return ivar / uvar;\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Division with signed and unsigned operators\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Division with signed and unsigned operators\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void division2()
|
||||
|
@ -86,8 +86,8 @@ private:
|
|||
" unsigned int uvar = 2;\n"
|
||||
" return uvar / ivar;\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Division with signed and unsigned operators\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Division with signed and unsigned operators\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void division4()
|
||||
|
@ -166,8 +166,8 @@ private:
|
|||
" unsigned int c = a / b;\n"
|
||||
" }\n"
|
||||
"}\n", true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("unsigned division", errout.str());
|
||||
TODO_ASSERT_EQUALS("unsigned division",
|
||||
"", errout.str());
|
||||
|
||||
check("void a(int i) { }\n"
|
||||
"int foo( unsigned int sz )\n"
|
||||
|
@ -186,8 +186,8 @@ private:
|
|||
" unsigned long uvar = 2;\n"
|
||||
" return ivar / uvar;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("unsigned division", errout.str());
|
||||
TODO_ASSERT_EQUALS("unsigned division",
|
||||
"", errout.str());
|
||||
|
||||
check("void f()\n"
|
||||
"{\n"
|
||||
|
@ -195,8 +195,8 @@ private:
|
|||
" unsigned long long uvar = 2;\n"
|
||||
" return ivar / uvar;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("unsigned division", errout.str());
|
||||
TODO_ASSERT_EQUALS("unsigned division",
|
||||
"", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -403,8 +403,8 @@ private:
|
|||
ASSERT_EQUALS(";;dealloc;", getcode("char *s; free(reinterpret_cast<void *>(s));", "s"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete s;", "s"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete (s);", "s"));
|
||||
ASSERT_EQUALS(";;;", getcode("char *s; delete (void *)(s);", "s")); // current result..
|
||||
TODO_ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete (void *)(s);", "s")); // ..wanted result
|
||||
TODO_ASSERT_EQUALS(";;dealloc;",
|
||||
";;;", getcode("char *s; delete (void *)(s);", "s"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] s;", "s"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("char *s; delete [] (s);", "s"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("void *p; foo(fclose(p));", "p"));
|
||||
|
@ -453,7 +453,8 @@ private:
|
|||
|
||||
// Since we don't check how the return value is used we must bail out
|
||||
ASSERT_EQUALS("", getcode("char *s; int ret = asprintf(&s, \"xyz\");", "s"));
|
||||
TODO_ASSERT_EQUALS(";;alloc;", getcode("char *s; int ret; ret=asprintf(&s, \"xyz\"); if (ret==-1) return;", "s"));
|
||||
TODO_ASSERT_EQUALS(";;alloc;",
|
||||
"", getcode("char *s; int ret; ret=asprintf(&s, \"xyz\"); if (ret==-1) return;", "s"));
|
||||
|
||||
// use..
|
||||
ASSERT_EQUALS(";;use;", getcode("char *s; a(s);", "s"));
|
||||
|
@ -695,10 +696,8 @@ private:
|
|||
ASSERT_EQUALS("; use ;", simplifycode("; while1 { if { dealloc ; return ; } if { if { continue ; } } }"));
|
||||
|
||||
// scope..
|
||||
// current result - ok
|
||||
ASSERT_EQUALS("; assign ; dealloc ; if alloc ; }", simplifycode("; assign ; { dealloc ; if alloc ; } }"));
|
||||
// wanted result - better
|
||||
TODO_ASSERT_EQUALS("; assign ; if alloc ; }", simplifycode("; assign ; { dealloc ; if alloc ; } }"));
|
||||
TODO_ASSERT_EQUALS("; assign ; if alloc ; }",
|
||||
"; assign ; dealloc ; if alloc ; }", simplifycode("; assign ; { dealloc ; if alloc ; } }"));
|
||||
|
||||
// callfunc..
|
||||
ASSERT_EQUALS("; callfunc ; }", simplifycode(";callfunc;}"));
|
||||
|
@ -713,8 +712,10 @@ private:
|
|||
ASSERT_EQUALS(";", simplifycode("; if { alloc; exit; }"));
|
||||
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; if { use; exit; }"));
|
||||
ASSERT_EQUALS("; alloc ;", simplifycode("; alloc ; if(!var) { exit; }"));
|
||||
TODO_ASSERT_EQUALS(";", simplifycode("; alloc ; if(var) { exit; }"));
|
||||
TODO_ASSERT_EQUALS(";\n; alloc ;", simplifycode("; alloc ; ifv { exit; }"));
|
||||
TODO_ASSERT_EQUALS(";",
|
||||
"; if(var) exit ;", simplifycode("; alloc ; if(var) { exit; }"));
|
||||
TODO_ASSERT_EQUALS(";\n; alloc ;",
|
||||
"; alloc ; ifv exit ;", simplifycode("; alloc ; ifv { exit; }"));
|
||||
|
||||
// try-catch
|
||||
ASSERT_EQUALS("; }", simplifycode("; try ; catch exit ; }"));
|
||||
|
@ -808,8 +809,8 @@ private:
|
|||
ASSERT_EQUALS(2, dofindleak(";alloc;\n if assign;\n dealloc;"));
|
||||
|
||||
// loop..
|
||||
TODO_ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if break; dealloc ; }"));
|
||||
TODO_ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if continue; dealloc ; }"));
|
||||
TODO_ASSERT_EQUALS(1, notfound, dofindleak("; loop { alloc ; if break; dealloc ; }"));
|
||||
TODO_ASSERT_EQUALS(1, notfound, dofindleak("; loop { alloc ; if continue; dealloc ; }"));
|
||||
ASSERT_EQUALS(notfound, dofindleak("; loop { alloc ; if break; } dealloc ;"));
|
||||
ASSERT_EQUALS(1, dofindleak("; loop alloc ;"));
|
||||
ASSERT_EQUALS(1, dofindleak("; loop alloc ; dealloc ;"));
|
||||
|
@ -1132,13 +1133,11 @@ private:
|
|||
" }\n"
|
||||
" delete [] x;\n"
|
||||
"}\n", true);
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: x\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: x\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void forwhile5()
|
||||
{
|
||||
check("void f(const char **a)\n"
|
||||
|
@ -1187,8 +1186,10 @@ private:
|
|||
"\n"
|
||||
" return a;\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: a\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:8]: (error) Common realloc mistake: \'a\' nulled but not freed upon failure\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: a\n",
|
||||
|
||||
"[test.cpp:8]: (error) Common realloc mistake: \'a\' nulled but not freed upon failure\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1478,8 +1479,8 @@ private:
|
|||
" char *p = new char[100];\n"
|
||||
" foo(p);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: p\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: p\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1880,8 +1881,8 @@ private:
|
|||
" char *p;\n"
|
||||
" foo(&p);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS(std::string("[test.cpp:11]: (error) Memory leak: p\n"), errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS(std::string("[test.cpp:11]: (error) Memory leak: p\n"),
|
||||
"", errout.str());
|
||||
|
||||
check("void foo(char **str)\n"
|
||||
"{\n"
|
||||
|
@ -2083,8 +2084,10 @@ private:
|
|||
" free(a);\n"
|
||||
"}\n");
|
||||
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: a\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Common realloc mistake: \'a\' nulled but not freed upon failure\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: a\n",
|
||||
|
||||
"[test.cpp:4]: (error) Common realloc mistake: \'a\' nulled but not freed upon failure\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
void realloc5()
|
||||
|
@ -2296,8 +2299,8 @@ private:
|
|||
" free(str);\n"
|
||||
" char c = *str;\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Dereferencing 'str' after it is deallocated / released\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Dereferencing 'str' after it is deallocated / released\n",
|
||||
"", errout.str());
|
||||
|
||||
check("void foo()\n"
|
||||
"{\n"
|
||||
|
@ -4184,8 +4187,8 @@ private:
|
|||
"private:\n"
|
||||
" char *s;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("publicAllocation", errout.str());
|
||||
TODO_ASSERT_EQUALS("publicAllocation",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void func2()
|
||||
|
|
|
@ -464,8 +464,8 @@ private:
|
|||
" p = new FooCar;\n"
|
||||
" p->abcd();\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:8]: (error) Possible null pointer dereference: p\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:8]: (error) Possible null pointer dereference: p\n",
|
||||
"", errout.str());
|
||||
|
||||
check("static void foo()\n"
|
||||
"{\n"
|
||||
|
@ -707,8 +707,8 @@ private:
|
|||
" argv32[i] = 0;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("error", errout.str());
|
||||
TODO_ASSERT_EQUALS("error",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void nullpointer7()
|
||||
|
|
|
@ -166,8 +166,8 @@ private:
|
|||
" const char i = index(var, 0);\n"
|
||||
" return i;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void test_qt_index()
|
||||
|
|
|
@ -1662,8 +1662,9 @@ private:
|
|||
"}\n"
|
||||
);
|
||||
TODO_ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0"
|
||||
" bytes of \"p\". Second and third arguments might be inverted.\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
" bytes of \"p\". Second and third arguments might be inverted.\n",
|
||||
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void sizeofForArrayParameter()
|
||||
|
|
|
@ -295,7 +295,8 @@ private:
|
|||
" std::cout << k << std::endl;\n"
|
||||
" return 0;\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("",
|
||||
"[test.cpp:8]: (performance) Prefer prefix ++/-- operators for non-primitive types.\n", errout.str());
|
||||
}
|
||||
|
||||
void testiterator()
|
||||
|
|
|
@ -429,8 +429,8 @@ private:
|
|||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// Make sure an error message is written..
|
||||
ASSERT_EQUALS("", errout.str()); // no change?
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: this preprocessor condition is always true", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: this preprocessor condition is always true",
|
||||
"", errout.str());
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS("\n\n\n\n\n\n", actual[""]);
|
||||
|
@ -755,7 +755,7 @@ private:
|
|||
ASSERT_EQUALS(true, Preprocessor::match_cfg_def(cfg, "A<2"));
|
||||
ASSERT_EQUALS(false, Preprocessor::match_cfg_def(cfg, "A==2"));
|
||||
ASSERT_EQUALS(false, Preprocessor::match_cfg_def(cfg, "A<1"));
|
||||
TODO_ASSERT_EQUALS(true, Preprocessor::match_cfg_def(cfg, "A>=1&&B<=A"));
|
||||
TODO_ASSERT_EQUALS(true, false, Preprocessor::match_cfg_def(cfg, "A>=1&&B<=A"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,8 @@ private:
|
|||
// Compare results..
|
||||
ASSERT_EQUALS(1, static_cast<unsigned int>(actual.size()));
|
||||
ASSERT_EQUALS("\n\n\nB\n\n", actual[""]);
|
||||
TODO_ASSERT_EQUALS("\nA\n\n\n\n", actual["LIBVER=101"]);
|
||||
TODO_ASSERT_EQUALS("\nA\n\n\n\n",
|
||||
"", actual["LIBVER=101"]);
|
||||
}
|
||||
|
||||
void if_cond2()
|
||||
|
@ -1009,8 +1010,7 @@ private:
|
|||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS(1, static_cast<unsigned int>(actual.size()));
|
||||
TODO_ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
||||
TODO_ASSERT_EQUALS(2, 1, static_cast<unsigned int>(actual.size()));
|
||||
ASSERT_EQUALS("\nfoo();\n\n", actual[""]);
|
||||
}
|
||||
}
|
||||
|
@ -1170,8 +1170,9 @@ private:
|
|||
|
||||
// the "defined(DEF_10) || defined(DEF_11)" are not handled correctly..
|
||||
ASSERT_EQUALS("(debug) unhandled configuration: defined(DEF_10)||defined(DEF_11)\n", errout.str());
|
||||
TODO_ASSERT_EQUALS(2, actual.size());
|
||||
TODO_ASSERT_EQUALS("\na1;\n\n", actual["DEF_10"]);
|
||||
TODO_ASSERT_EQUALS(2, 1, actual.size());
|
||||
TODO_ASSERT_EQUALS("\na1;\n\n",
|
||||
"", actual["DEF_10"]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2312,8 +2313,8 @@ private:
|
|||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS("\n\n\n\n", actual[""]);
|
||||
TODO_ASSERT_EQUALS(1, actual.size());
|
||||
ASSERT_EQUALS(2, (int)actual.size());
|
||||
TODO_ASSERT_EQUALS(1,
|
||||
2, actual.size());
|
||||
}
|
||||
|
||||
void define_ifndef2()
|
||||
|
@ -2401,21 +2402,27 @@ private:
|
|||
preprocessor.preprocess(istr, actual, "file.c");
|
||||
|
||||
// B will always be defined if A is defined; the following test
|
||||
// cases should be fixed whenever this other bug is fixed
|
||||
TODO_ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
||||
ASSERT_EQUALS(3, static_cast<unsigned int>(actual.size()));
|
||||
// cases should be fixed whenever this other bug is fixed
|
||||
TODO_ASSERT_EQUALS(2,
|
||||
3, static_cast<unsigned int>(actual.size()));
|
||||
|
||||
if (actual.find("A") == actual.end()) {
|
||||
ASSERT_EQUALS("A is checked", "failed");
|
||||
} else {
|
||||
ASSERT_EQUALS("A is checked", "A is checked");
|
||||
}
|
||||
if (actual.find("A") == actual.end())
|
||||
{
|
||||
ASSERT_EQUALS("A is checked", "failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT_EQUALS("A is checked", "A is checked");
|
||||
}
|
||||
|
||||
if (actual.find("A;A;B") != actual.end()) {
|
||||
ASSERT_EQUALS("A;A;B is NOT checked", "failed");
|
||||
} else {
|
||||
ASSERT_EQUALS("A;A;B is NOT checked", "A;A;B is NOT checked");
|
||||
}
|
||||
if (actual.find("A;A;B") != actual.end())
|
||||
{
|
||||
ASSERT_EQUALS("A;A;B is NOT checked", "failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT_EQUALS("A;A;B is NOT checked", "A;A;B is NOT checked");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -697,8 +697,8 @@ private:
|
|||
" if (c>0) { c++; }\n"
|
||||
" c++;\n"
|
||||
"}\n";
|
||||
TODO_ASSERT_EQUALS("void f ( int & c ) { c = 3 ; { ; } ; }", tok(code));
|
||||
ASSERT_EQUALS("void f ( int & c ) { c = 1 ; { c ++ ; } c ++ ; }", tok(code));
|
||||
TODO_ASSERT_EQUALS("void f ( int & c ) { c = 3 ; { ; } ; }",
|
||||
"void f ( int & c ) { c = 1 ; { c ++ ; } c ++ ; }", tok(code));
|
||||
}
|
||||
|
||||
|
||||
|
@ -712,8 +712,8 @@ private:
|
|||
" if (c>0) { ++c; }\n"
|
||||
" ++c;\n"
|
||||
"}\n";
|
||||
TODO_ASSERT_EQUALS("void f ( int & c ) { c = 3 ; { ; } ; }", tok(code));
|
||||
ASSERT_EQUALS("void f ( int & c ) { c = 1 ; { ++ c ; } ++ c ; }", tok(code));
|
||||
TODO_ASSERT_EQUALS("void f ( int & c ) { c = 3 ; { ; } ; }",
|
||||
"void f ( int & c ) { c = 1 ; { ++ c ; } ++ c ; }", tok(code));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1600,14 +1600,22 @@ private:
|
|||
" return 0;\n"
|
||||
"}\n";
|
||||
|
||||
const std::string expected("; "
|
||||
"int main ( ) { "
|
||||
"std :: vector < int > v ; "
|
||||
"v . push_back ( 4 ) ; "
|
||||
"return 0 ; "
|
||||
"}");
|
||||
const std::string wanted("; "
|
||||
"int main ( ) { "
|
||||
"std :: vector < int > v ; "
|
||||
"v . push_back ( 4 ) ; "
|
||||
"return 0 ; "
|
||||
"}");
|
||||
|
||||
TODO_ASSERT_EQUALS(expected, sizeof_(code));
|
||||
const std::string current("; "
|
||||
"int main ( ) { "
|
||||
"ABC < int > :: type v ; "
|
||||
"v . push_back ( 4 ) ; "
|
||||
"return 0 ; "
|
||||
"}"
|
||||
);
|
||||
|
||||
TODO_ASSERT_EQUALS(wanted, current, sizeof_(code));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1822,14 +1830,18 @@ private:
|
|||
" return 0;\n"
|
||||
"}\n";
|
||||
|
||||
// The expected result..
|
||||
const std::string expected("; "
|
||||
"; "
|
||||
"int main ( ) { b<2> ( ) ; return 0 ; } "
|
||||
"void b<2> ( ) { a<2> ( ) ; } "
|
||||
"void a<2> ( ) { }");
|
||||
const std::string wanted("; "
|
||||
"; "
|
||||
"int main ( ) { b<2> ( ) ; return 0 ; } "
|
||||
"void b<2> ( ) { a<2> ( ) ; } "
|
||||
"void a<2> ( ) { }");
|
||||
|
||||
TODO_ASSERT_EQUALS(expected, sizeof_(code));
|
||||
const std::string current("; "
|
||||
"int main ( ) { b<2> ( ) ; return 0 ; } "
|
||||
"void b<2> ( ) { a < 2 > ( ) ; }"
|
||||
);
|
||||
|
||||
TODO_ASSERT_EQUALS(wanted, current, sizeof_(code));
|
||||
}
|
||||
|
||||
void template17()
|
||||
|
@ -1845,7 +1857,7 @@ private:
|
|||
"\n"
|
||||
"shared_ptr<int> i;\n";
|
||||
|
||||
// Assert that there are not segmentation fault..
|
||||
// Assert that there is no segmentation fault..
|
||||
sizeof_(code);
|
||||
}
|
||||
|
||||
|
@ -2030,20 +2042,29 @@ private:
|
|||
" A<int> a2;\n"
|
||||
"}\n";
|
||||
|
||||
// The expected result..
|
||||
const std::string expected("template < class T , int n >"
|
||||
" class A"
|
||||
" { T ar [ n ] ; } ;"
|
||||
" void f ( )"
|
||||
" {"
|
||||
" A<int,(int)2> a1 ;"
|
||||
" A<int,3> a2 ;"
|
||||
" }"
|
||||
" class A<int,2>"
|
||||
" { int ar [ 2 ] ; }"
|
||||
" class A<int,3>"
|
||||
" { int ar [ 3 ] ; }");
|
||||
TODO_ASSERT_EQUALS(expected, sizeof_(code));
|
||||
const std::string wanted("template < class T , int n >"
|
||||
" class A"
|
||||
" { T ar [ n ] ; } ;"
|
||||
" void f ( )"
|
||||
" {"
|
||||
" A<int,(int)2> a1 ;"
|
||||
" A<int,3> a2 ;"
|
||||
" }"
|
||||
" class A<int,2>"
|
||||
" { int ar [ 2 ] ; }"
|
||||
" class A<int,3>"
|
||||
" { int ar [ 3 ] ; }");
|
||||
|
||||
const std::string current("; "
|
||||
"void f ( ) "
|
||||
"{ "
|
||||
"A < int , ( int ) 2 > a1 ; "
|
||||
"A<int,3> a2 ; "
|
||||
"} "
|
||||
"class A<int,3> "
|
||||
"{ int ar [ 3 ] ; }"
|
||||
);
|
||||
TODO_ASSERT_EQUALS(wanted, current, sizeof_(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2177,7 +2198,9 @@ private:
|
|||
ASSERT_EQUALS("; a . x = b ( ) ; if ( ! ( a . x ) ) { ; }", simplifyIfAssign(";if(!(a->x=b()));"));
|
||||
ASSERT_EQUALS("A ( ) a = b ; if ( a ) { ; }", simplifyIfAssign("A() if(a=b);"));
|
||||
ASSERT_EQUALS("void foo ( int a ) { a = b ( ) ; if ( 0 <= a ) { ; } }", tok("void foo(int a) {if((a=b())>=0);}"));
|
||||
TODO_ASSERT_EQUALS("void foo ( A a ) { a . c = b ( ) ; if ( 0 <= a . c ) { ; } }", tok("void foo(A a) {if((a.c=b())>=0);}"));
|
||||
TODO_ASSERT_EQUALS("void foo ( A a ) { a . c = b ( ) ; if ( 0 <= a . c ) { ; } }",
|
||||
"void foo ( A a ) { a . c = b ( ) ; if ( a . c >= 0 ) { ; } }",
|
||||
tok("void foo(A a) {if((a.c=b())>=0);}"));
|
||||
}
|
||||
|
||||
void ifAssignWithCast()
|
||||
|
@ -3508,14 +3531,20 @@ private:
|
|||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
|
||||
// TODO: the definition and assignment should be split up
|
||||
const char todo[] =
|
||||
const char wanted[] =
|
||||
"; "
|
||||
"void g ( fp f ) "
|
||||
"{ "
|
||||
"int ( * f2 ) ( ) ; f2 = ( int ( * ) ( ) ) f ; "
|
||||
"}";
|
||||
const char current[] =
|
||||
"; "
|
||||
"void g ( int ( * f ) ( ) ) "
|
||||
"{ "
|
||||
"int ( * f2 ) ( ) = ( int ( * ) ( ) ) f ; "
|
||||
"}";
|
||||
|
||||
TODO_ASSERT_EQUALS(todo, tok(code, false));
|
||||
TODO_ASSERT_EQUALS(wanted, current, tok(code, false));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -6159,7 +6188,9 @@ private:
|
|||
ASSERT_EQUALS("; struct A a ; a . buf = x ;", tok("; struct A a = { .buf = x };"));
|
||||
ASSERT_EQUALS("; struct A a ; a . buf = & key ;", tok("; struct A a = { .buf = &key };"));
|
||||
ASSERT_EQUALS("; struct ABC abc ; abc . a = 3 ; abc . b = x ; abc . c = & key ;", tok("; struct ABC abc = { .a = 3, .b = x, .c = &key };"));
|
||||
TODO_ASSERT_EQUALS("; struct A a ; a . buf = { 0 } ;", tok("; struct A a = { .buf = {0} };"));
|
||||
TODO_ASSERT_EQUALS("; struct A a ; a . buf = { 0 } ;",
|
||||
"; struct A a ; a = { . buf = { 0 } } ;",
|
||||
tok("; struct A a = { .buf = {0} };"));
|
||||
}
|
||||
|
||||
void simplifyStructDecl()
|
||||
|
|
|
@ -257,8 +257,7 @@ private:
|
|||
" ++aI;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:14] (error) After insert, the iterator 'aI' may be invalid", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:14] (error) After insert, the iterator 'aI' may be invalid", "", errout.str());
|
||||
}
|
||||
|
||||
void iterator8()
|
||||
|
@ -629,8 +628,7 @@ private:
|
|||
" }\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:9]: (error) Dangerous iterator usage after erase()-method.\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:9]: (error) Dangerous iterator usage after erase()-method.\n", "", errout.str());
|
||||
}
|
||||
|
||||
void eraseGoto()
|
||||
|
@ -701,7 +699,7 @@ private:
|
|||
" foo.erase(*it);\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Iterator 'it' becomes invalid when deleted by value from 'foo'\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Iterator 'it' becomes invalid when deleted by value from 'foo'\n", "", errout.str());
|
||||
|
||||
check("void f()\n"
|
||||
"{\n"
|
||||
|
|
|
@ -176,9 +176,13 @@ void TestFixture::assertEqualsDouble(const char *filename, int linenr, double ex
|
|||
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
|
||||
}
|
||||
|
||||
void TestFixture::todoAssertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual)
|
||||
void TestFixture::todoAssertEquals(const char *filename, int linenr,
|
||||
const std::string &wanted,
|
||||
const std::string ¤t,
|
||||
const std::string &actual)
|
||||
{
|
||||
if (expected == actual)
|
||||
assertEquals(filename, linenr, current, actual);
|
||||
if (wanted == actual)
|
||||
{
|
||||
assertEquals(filename, linenr, "TODO assertion", "The assertion succeeded");
|
||||
}
|
||||
|
@ -188,13 +192,13 @@ void TestFixture::todoAssertEquals(const char *filename, int linenr, const std::
|
|||
}
|
||||
}
|
||||
|
||||
void TestFixture::todoAssertEquals(const char *filename, int linenr, unsigned int expected, unsigned int actual)
|
||||
void TestFixture::todoAssertEquals(const char *filename, int linenr, unsigned int wanted, unsigned int current, unsigned int actual)
|
||||
{
|
||||
std::ostringstream ostr1;
|
||||
ostr1 << expected;
|
||||
std::ostringstream ostr2;
|
||||
ostr2 << actual;
|
||||
todoAssertEquals(filename, linenr, ostr1.str(), ostr2.str());
|
||||
std::ostringstream wantedStr, currentStr, actualStr;
|
||||
wantedStr << wanted;
|
||||
currentStr << current;
|
||||
actualStr << actual;
|
||||
todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str());
|
||||
}
|
||||
|
||||
void TestFixture::assertThrowFail(const char *filename, int linenr)
|
||||
|
|
|
@ -52,8 +52,10 @@ protected:
|
|||
void assertEquals(const char *filename, int linenr, long long expected, long long actual, const std::string &msg="");
|
||||
void assertEqualsDouble(const char *filename, int linenr, double expected, double actual, const std::string &msg="");
|
||||
|
||||
void todoAssertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
|
||||
void todoAssertEquals(const char *filename, int linenr, unsigned int expected, unsigned int actual);
|
||||
void todoAssertEquals(const char *filename, int linenr, const std::string &wanted,
|
||||
const std::string ¤t, const std::string &actual);
|
||||
void todoAssertEquals(const char *filename, int linenr, unsigned int wanted,
|
||||
unsigned int current, unsigned int actual);
|
||||
void assertThrowFail(const char *filename, int linenr);
|
||||
void processOptions(const options& args);
|
||||
public:
|
||||
|
@ -75,7 +77,7 @@ public:
|
|||
#define ASSERT_EQUALS_DOUBLE( EXPECTED , ACTUAL ) assertEqualsDouble(__FILE__, __LINE__, EXPECTED, ACTUAL)
|
||||
#define ASSERT_EQUALS_MSG( EXPECTED , ACTUAL, MSG ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL, MSG)
|
||||
#define ASSERT_THROW( CMD, EXCEPTION ) try { CMD ; assertThrowFail(__FILE__, __LINE__); } catch (EXCEPTION &) { } catch (...) { assertThrowFail(__FILE__, __LINE__); }
|
||||
#define TODO_ASSERT_EQUALS( EXPECTED , ACTUAL ) todoAssertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL)
|
||||
#define TODO_ASSERT_EQUALS( WANTED , CURRENT , ACTUAL ) todoAssertEquals(__FILE__, __LINE__, WANTED, CURRENT, ACTUAL)
|
||||
#define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance; }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1132,11 +1132,9 @@ private:
|
|||
|
||||
TODO_ASSERT_EQUALS(
|
||||
expected1 + " if ( true ) { a ( ) ; } }",
|
||||
simplifyKnownVariables(code));
|
||||
|
||||
ASSERT_EQUALS(
|
||||
expected1 + " if ( b ) { a ( ) ; } }",
|
||||
simplifyKnownVariables(code));
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1156,6 +1154,7 @@ private:
|
|||
|
||||
TODO_ASSERT_EQUALS(
|
||||
"void f ( ) { bool b ; b = false ; { b = false ; } { b = true ; } if ( true ) { a ( ) ; } }",
|
||||
"void f ( ) { bool b ; b = false ; { b = false ; } { b = true ; } if ( b ) { a ( ) ; } }",
|
||||
simplifyKnownVariables(code));
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1365,6 @@ private:
|
|||
" }\n"
|
||||
"}\n";
|
||||
|
||||
// wanted result
|
||||
TODO_ASSERT_EQUALS(
|
||||
"void foo ( int x ) "
|
||||
"{"
|
||||
|
@ -1374,16 +1372,14 @@ private:
|
|||
" if ( x ) { a [ 0 ] = 0 ; c = 1 ; }"
|
||||
" else { a [ 0 ] = 0 ; } "
|
||||
"}",
|
||||
simplifyKnownVariables(code));
|
||||
|
||||
// Current result
|
||||
ASSERT_EQUALS(
|
||||
"void foo ( int x ) "
|
||||
"{"
|
||||
" int a [ 10 ] ; int c ; c = 0 ;"
|
||||
" if ( x ) { a [ 0 ] = 0 ; c ++ ; }"
|
||||
" else { a [ c ] = 0 ; } "
|
||||
"}",
|
||||
|
||||
simplifyKnownVariables(code));
|
||||
}
|
||||
|
||||
|
@ -1638,14 +1634,21 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h | i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4:\n"
|
||||
"5: return u@1 | v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4:\n"
|
||||
"5: return u@1 | v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: int i@4 ; i@4 = v@2 ;\n"
|
||||
"5: return u@1 | i@4 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1655,14 +1658,21 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h ^ i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4:\n"
|
||||
"5: return u@1 ^ v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4:\n"
|
||||
"5: return u@1 ^ v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: int i@4 ; i@4 = v@2 ;\n"
|
||||
"5: return u@1 ^ i@4 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1672,14 +1682,21 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h % i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4:\n"
|
||||
"5: return u@1 % v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4:\n"
|
||||
"5: return u@1 % v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n"
|
||||
"1: int foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: int i@4 ; i@4 = v@2 ;\n"
|
||||
"5: return u@1 % i@4 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1723,14 +1740,22 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h == i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 == v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 == v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: int i@4 ; i@4 = v@2 ;\n"
|
||||
"5: return u@1 == i@4 ;\n"
|
||||
"6: }\n";
|
||||
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1740,14 +1765,21 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h != i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 != v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 != v@2 ;\n"
|
||||
"4: int i@4 ; i@4 = v@2 ;\n"
|
||||
"5: return u@1 != i@4 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1757,14 +1789,15 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h > i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 > v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 > v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 > i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1774,14 +1807,15 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h >= i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 >= v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 >= v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 >= i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1791,14 +1825,15 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h < i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 < v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 < v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 < i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1808,14 +1843,15 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h <= i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 <= v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 <= v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 <= i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1825,14 +1861,15 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h && i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 && v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 && v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 && i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1842,14 +1879,15 @@ private:
|
|||
" int i = v;\n"
|
||||
" return h || i;\n"
|
||||
"}\n";
|
||||
const char expected[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 || v@2 ;\n"
|
||||
"6: }\n";
|
||||
TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true));
|
||||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"5: return u@1 || v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3: ;\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 || i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3212,20 +3250,21 @@ private:
|
|||
" A::buf[10] = 0;\n"
|
||||
"}");
|
||||
|
||||
const std::string expected("\n\n##file 0\n"
|
||||
"1: class A\n"
|
||||
"2: {\n"
|
||||
"3: public:\n"
|
||||
"4: static char buf@1 [ 20 ] ;\n"
|
||||
"5: } ;\n"
|
||||
"6: char A :: buf@1 [ 20 ] ;\n"
|
||||
"7: int main ( )\n"
|
||||
"8: {\n"
|
||||
"9: char buf@2 [ 2 ] ;\n"
|
||||
"10: A :: buf@1 [ 10 ] = 0 ;\n"
|
||||
"11: }\n");
|
||||
const std::string wanted("\n\n##file 0\n"
|
||||
"1: class A\n"
|
||||
"2: {\n"
|
||||
"3: public:\n"
|
||||
"4: static char buf@1 [ 20 ] ;\n"
|
||||
"5: } ;\n"
|
||||
"6: char A :: buf@1 [ 20 ] ;\n"
|
||||
"7: int main ( )\n"
|
||||
"8: {\n"
|
||||
"9: char buf@2 [ 2 ] ;\n"
|
||||
"10: A :: buf@1 [ 10 ] = 0 ;\n"
|
||||
"11: }\n");
|
||||
|
||||
TODO_ASSERT_EQUALS(expected, actual);
|
||||
const char current[] = "\n\n##file 0\n1: class A\n2: {\n3: public:\n4: static char buf@1 [ 20 ] ;\n5: } ;\n6: char A :: buf [ 20 ] ;\n7: int main ( )\n8: {\n9: char buf@2 [ 2 ] ;\n10: A :: buf [ 10 ] = 0 ;\n11: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, actual);
|
||||
}
|
||||
|
||||
void varidclass7()
|
||||
|
@ -3895,12 +3934,12 @@ private:
|
|||
void vardecl_stl_2()
|
||||
{
|
||||
const char code1[] = "{ std::string x = \"abc\"; }";
|
||||
TODO_ASSERT_EQUALS("{ std :: string x ; x = \"abc\" ; }", tokenizeAndStringify(code1));
|
||||
ASSERT_EQUALS("{ std :: string x = \"abc\" ; }", tokenizeAndStringify(code1));
|
||||
TODO_ASSERT_EQUALS("{ std :: string x ; x = \"abc\" ; }",
|
||||
"{ std :: string x = \"abc\" ; }", tokenizeAndStringify(code1));
|
||||
|
||||
const char code2[] = "{ std::vector<int> x = y; }";
|
||||
TODO_ASSERT_EQUALS("{ std :: vector < int > x ; x = y ; }", tokenizeAndStringify(code2));
|
||||
ASSERT_EQUALS("{ std :: vector < int > x = y ; }", tokenizeAndStringify(code2));
|
||||
TODO_ASSERT_EQUALS("{ std :: vector < int > x ; x = y ; }",
|
||||
"{ std :: vector < int > x = y ; }", tokenizeAndStringify(code2));
|
||||
}
|
||||
|
||||
void vardecl_template()
|
||||
|
@ -4569,8 +4608,8 @@ private:
|
|||
{
|
||||
// tokenize ">>" into "> >"
|
||||
const char *code = "list<list<int>> ints;\n";
|
||||
ASSERT_EQUALS("list < list < int >> ints ;", tokenizeAndStringify(code));
|
||||
TODO_ASSERT_EQUALS("list < list < int > > ints ;", tokenizeAndStringify(code));
|
||||
TODO_ASSERT_EQUALS("list < list < int > > ints ;",
|
||||
"list < list < int >> ints ;", tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
void cpp0xdefault()
|
||||
|
@ -4602,8 +4641,8 @@ private:
|
|||
" foo();"
|
||||
"}"
|
||||
"foo::foo() = delete;";
|
||||
ASSERT_EQUALS("struct foo { foo ( ) ; } foo :: foo ( ) = delete ;", tokenizeAndStringify(code));
|
||||
TODO_ASSERT_EQUALS("struct foo { }", tokenizeAndStringify(code));
|
||||
TODO_ASSERT_EQUALS("struct foo { }",
|
||||
"struct foo { foo ( ) ; } foo :: foo ( ) = delete ;", tokenizeAndStringify(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -798,8 +798,8 @@ private:
|
|||
" x--;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: pItem\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str()); // current result
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: pItem\n",
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
// switch..
|
||||
|
@ -1364,8 +1364,8 @@ private:
|
|||
" int x[10];\n"
|
||||
" calc(x,10);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n",
|
||||
"", errout.str());
|
||||
|
||||
// #2401 - unknown function/macro might init the variable
|
||||
checkUninitVar("int f() {\n"
|
||||
|
|
|
@ -657,7 +657,8 @@ private:
|
|||
" int a[10];\n"
|
||||
" f(a[0]);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is not assigned a value\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is not assigned a value\n",
|
||||
"", errout.str());
|
||||
|
||||
// f() can not write a (not supported yet)
|
||||
functionVariableUsage("void f(const int & i) { }\n"
|
||||
|
@ -666,7 +667,8 @@ private:
|
|||
" int a[10];\n"
|
||||
" f(a[0]);\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is not assigned a value\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable 'a' is not assigned a value\n",
|
||||
"", errout.str());
|
||||
|
||||
// f() writes a
|
||||
functionVariableUsage("void f(int & i) { }\n"
|
||||
|
@ -811,37 +813,37 @@ private:
|
|||
"{\n"
|
||||
" int * i[2];\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void foo()\n"
|
||||
"{\n"
|
||||
" const int * i[2];\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void foo()\n"
|
||||
"{\n"
|
||||
" void * i[2];\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void foo()\n"
|
||||
"{\n"
|
||||
" const void * i[2];\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void foo()\n"
|
||||
"{\n"
|
||||
" struct A * i[2];\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void foo()\n"
|
||||
"{\n"
|
||||
" const struct A * i[2];\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void foo(int n)\n"
|
||||
"{\n"
|
||||
|
@ -1076,15 +1078,14 @@ private:
|
|||
" a = b = c;\n"
|
||||
"\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS(
|
||||
"[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used\n"
|
||||
"[test.cpp:3]: (style) Variable 'b' is assigned a value that is never used\n",
|
||||
errout.str());
|
||||
|
||||
TODO_ASSERT_EQUALS(
|
||||
"[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used\n"
|
||||
"[test.cpp:3]: (style) Variable 'b' is assigned a value that is never used\n"
|
||||
"[test.cpp:3]: (style) Variable 'c' is assigned a value that is never used\n",
|
||||
|
||||
"[test.cpp:3]: (style) Variable 'a' is assigned a value that is never used\n"
|
||||
"[test.cpp:3]: (style) Variable 'b' is assigned a value that is never used\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
|
@ -2311,9 +2312,10 @@ private:
|
|||
" func();\n"
|
||||
" } while(a--);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Unused variable: x\n"
|
||||
"[test.cpp:4]: (style) Unused variable: z\n", errout.str());
|
||||
"[test.cpp:4]: (style) Unused variable: z\n",
|
||||
|
||||
"", errout.str());
|
||||
}
|
||||
|
||||
void localvarStruct4()
|
||||
|
|
Loading…
Reference in New Issue