Fixed testrunner
This commit is contained in:
parent
e6ff77d825
commit
ab6809f3fa
|
@ -6103,26 +6103,26 @@ private:
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" int x = dostuff();\n"
|
" int x = dostuff();\n"
|
||||||
" return x + x++;\n"
|
" return x + x++;\n"
|
||||||
"}");
|
"}", "test.c");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (error) Expression 'x+x++' depends on order of evaluation of side effects\n", errout.str());
|
ASSERT_EQUALS("[test.c:3]: (error) Expression 'x+x++' depends on order of evaluation of side effects\n", errout.str());
|
||||||
|
|
||||||
// #7226
|
// #7226
|
||||||
check("long int f1(const char *exp) {\n"
|
check("long int f1(const char *exp) {\n"
|
||||||
" return strtol(++exp, (char **)&exp, 10);\n"
|
" return strtol(++exp, (char **)&exp, 10);\n"
|
||||||
"}");
|
"}", "test.c");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (error) Expression '++exp,(char**)&exp' depends on order of evaluation of side effects\n", errout.str());
|
ASSERT_EQUALS("[test.c:2]: (error) Expression '++exp,(char**)&exp' depends on order of evaluation of side effects\n", errout.str());
|
||||||
|
|
||||||
// self assignment
|
// self assignment
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" int x = x = y + 1;\n"
|
" int x = x = y + 1;\n"
|
||||||
"}");
|
"}", "test.c");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Redundant assignment of 'x' to itself.\n", errout.str());
|
ASSERT_EQUALS("[test.c:2]: (warning) Redundant assignment of 'x' to itself.\n", errout.str());
|
||||||
|
|
||||||
// macro, dont bailout (#7233)
|
// macro, dont bailout (#7233)
|
||||||
check((std::string("void f(int x) {\n"
|
check((std::string("void f(int x) {\n"
|
||||||
" return x + ") + Preprocessor::macroChar + "x++;\n"
|
" return x + ") + Preprocessor::macroChar + "x++;\n"
|
||||||
"}").c_str());
|
"}").c_str(), "test.c");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (error) Expression 'x+x++' depends on order of evaluation of side effects\n", errout.str());
|
ASSERT_EQUALS("[test.c:2]: (error) Expression 'x+x++' depends on order of evaluation of side effects\n", errout.str());
|
||||||
|
|
||||||
|
|
||||||
// sequence points
|
// sequence points
|
||||||
|
@ -6130,13 +6130,13 @@ private:
|
||||||
// FP
|
// FP
|
||||||
check("void f(int id) {\n"
|
check("void f(int id) {\n"
|
||||||
" id = dostuff(id += 42);\n"
|
" id = dostuff(id += 42);\n"
|
||||||
"}");
|
"}", "test.c");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// FN
|
// FN
|
||||||
check("void f(int id) {\n"
|
check("void f(int id) {\n"
|
||||||
" id = id + dostuff(id += 42);\n"
|
" id = id + dostuff(id += 42);\n"
|
||||||
"}");
|
"}", "test.c");
|
||||||
TODO_ASSERT_EQUALS("error", "", errout.str());
|
TODO_ASSERT_EQUALS("error", "", errout.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue