Adjust more test results for invalid code

This commit is contained in:
amai2012 2019-04-19 20:53:07 +02:00
parent ebe7783493
commit 361fc44005
3 changed files with 27 additions and 27 deletions

View File

@ -143,10 +143,10 @@ private:
void isVariableChanged() { void isVariableChanged() {
// #8211 - no lhs for >> , do not crash // #8211 - no lhs for >> , do not crash
ASSERT_THROW(isVariableChanged("void f() {\n" isVariableChanged("void f() {\n"
" int b;\n" " int b;\n"
" if (b) { (int)((INTOF(8))result >> b); }\n" " if (b) { (int)((INTOF(8))result >> b); }\n"
"}", "if", "}"), InternalError);; "}", "if", "}");
} }
bool isVariableChangedByFunctionCall(const char code[], const char pattern[], bool *inconclusive) { bool isVariableChangedByFunctionCall(const char code[], const char pattern[], bool *inconclusive) {

View File

@ -990,7 +990,7 @@ private:
" return sizeof...(args);\n" " return sizeof...(args);\n"
" }();\n" " }();\n"
"}"; "}";
tok(code); ASSERT_THROW(tok(code), InternalError);
} }
void template43() { // #5097 - Assert due to '>>' in 'B<A<C>>' not being treated as end of template instantiation void template43() { // #5097 - Assert due to '>>' in 'B<A<C>>' not being treated as end of template instantiation

View File

@ -1100,10 +1100,10 @@ private:
// #4725 - ^{} // #4725 - ^{}
void simplifyAsm2() { void simplifyAsm2() {
ASSERT_EQUALS("void f ( ) { asm ( \"^{}\" ) ; }", tokenizeAndStringify("void f() { ^{} }")); ASSERT_THROW(ASSERT_EQUALS("void f ( ) { asm ( \"^{}\" ) ; }", tokenizeAndStringify("void f() { ^{} }")), InternalError);
ASSERT_EQUALS("void f ( ) { x ( asm ( \"^{}\" ) ) ; }", tokenizeAndStringify("void f() { x(^{}); }")); ASSERT_THROW(ASSERT_EQUALS("void f ( ) { x ( asm ( \"^{}\" ) ) ; }", tokenizeAndStringify("void f() { x(^{}); }")), InternalError);
ASSERT_EQUALS("void f ( ) { foo ( A ( ) , asm ( \"^{bar();}\" ) ) ; }", tokenizeAndStringify("void f() { foo(A(), ^{ bar(); }); }")); ASSERT_THROW(ASSERT_EQUALS("void f ( ) { foo ( A ( ) , asm ( \"^{bar();}\" ) ) ; }", tokenizeAndStringify("void f() { foo(A(), ^{ bar(); }); }")), InternalError);
ASSERT_EQUALS("int f0 ( Args args ) { asm ( \"asm(\"return^{returnsizeof...(Args);}()\")+^{returnsizeof...(args);}()\" )\n" ASSERT_THROW(ASSERT_EQUALS("int f0 ( Args args ) { asm ( \"asm(\"return^{returnsizeof...(Args);}()\")+^{returnsizeof...(args);}()\" )\n"
"2:\n" "2:\n"
"|\n" "|\n"
"5:\n" "5:\n"
@ -1114,19 +1114,19 @@ private:
" }() + ^ {\n" " }() + ^ {\n"
" return sizeof...(args);\n" " return sizeof...(args);\n"
" }();\n" " }();\n"
"};")); "};")), InternalError);
ASSERT_EQUALS("int ( ^ block ) ( void ) = asm ( \"^{staticinttest=0;returntest;}\" )\n\n\n;", ASSERT_THROW(ASSERT_EQUALS("int ( ^ block ) ( void ) = asm ( \"^{staticinttest=0;returntest;}\" )\n\n\n;",
tokenizeAndStringify("int(^block)(void) = ^{\n" tokenizeAndStringify("int(^block)(void) = ^{\n"
" static int test = 0;\n" " static int test = 0;\n"
" return test;\n" " return test;\n"
"};")); "};")), InternalError);
ASSERT_EQUALS("; return f ( a [ b = c ] , asm ( \"^{}\" ) ) ;", ASSERT_THROW(ASSERT_EQUALS("; return f ( a [ b = c ] , asm ( \"^{}\" ) ) ;",
tokenizeAndStringify("; return f(a[b=c],^{});")); // #7185 tokenizeAndStringify("; return f(a[b=c],^{});")), InternalError); // #7185
ASSERT_EQUALS("; return f ( asm ( \"^(void){somecode}\" ) ) ;", ASSERT_EQUALS("; return f ( asm ( \"^(void){somecode}\" ) ) ;",
tokenizeAndStringify("; return f(^(void){somecode});")); tokenizeAndStringify("; return f(^(void){somecode});"));
ASSERT_EQUALS("; asm ( \"a?(b?(c,asm(\"^{}\")):0):^{}\" ) ;", ASSERT_THROW(ASSERT_EQUALS("; asm ( \"a?(b?(c,asm(\"^{}\")):0):^{}\" ) ;",
tokenizeAndStringify(";a?(b?(c,^{}):0):^{};")); tokenizeAndStringify(";a?(b?(c,^{}):0):^{};")), InternalError);
ASSERT_EQUALS("template < typename T > " ASSERT_EQUALS("template < typename T > "
"CImg < T > operator| ( const char * const expression , const CImg < T > & img ) { " "CImg < T > operator| ( const char * const expression , const CImg < T > & img ) { "
"return img | expression ; " "return img | expression ; "