Skip to content

Commit 361fc44

Browse files
committed
Adjust more test results for invalid code
1 parent ebe7783 commit 361fc44

3 files changed

Lines changed: 27 additions & 27 deletions

File tree

test/testastutils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ class TestAstUtils : public TestFixture {
143143

144144
void isVariableChanged() {
145145
// #8211 - no lhs for >> , do not crash
146-
ASSERT_THROW(isVariableChanged("void f() {\n"
147-
" int b;\n"
148-
" if (b) { (int)((INTOF(8))result >> b); }\n"
149-
"}", "if", "}"), InternalError);;
146+
isVariableChanged("void f() {\n"
147+
" int b;\n"
148+
" if (b) { (int)((INTOF(8))result >> b); }\n"
149+
"}", "if", "}");
150150
}
151151

152152
bool isVariableChangedByFunctionCall(const char code[], const char pattern[], bool *inconclusive) {

test/testsimplifytemplate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ class TestSimplifyTemplate : public TestFixture {
990990
" return sizeof...(args);\n"
991991
" }();\n"
992992
"}";
993-
tok(code);
993+
ASSERT_THROW(tok(code), InternalError);
994994
}
995995

996996
void template43() { // #5097 - Assert due to '>>' in 'B<A<C>>' not being treated as end of template instantiation

test/testtokenize.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,33 +1100,33 @@ class TestTokenizer : public TestFixture {
11001100

11011101
// #4725 - ^{}
11021102
void simplifyAsm2() {
1103-
ASSERT_EQUALS("void f ( ) { asm ( \"^{}\" ) ; }", tokenizeAndStringify("void f() { ^{} }"));
1104-
ASSERT_EQUALS("void f ( ) { x ( asm ( \"^{}\" ) ) ; }", tokenizeAndStringify("void f() { x(^{}); }"));
1105-
ASSERT_EQUALS("void f ( ) { foo ( A ( ) , asm ( \"^{bar();}\" ) ) ; }", tokenizeAndStringify("void f() { foo(A(), ^{ bar(); }); }"));
1106-
ASSERT_EQUALS("int f0 ( Args args ) { asm ( \"asm(\"return^{returnsizeof...(Args);}()\")+^{returnsizeof...(args);}()\" )\n"
1107-
"2:\n"
1108-
"|\n"
1109-
"5:\n"
1110-
"6: ;\n"
1111-
"} ;", tokenizeAndStringify("int f0(Args args) {\n"
1112-
" return ^{\n"
1113-
" return sizeof...(Args);\n"
1114-
" }() + ^ {\n"
1115-
" return sizeof...(args);\n"
1116-
" }();\n"
1117-
"};"));
1118-
ASSERT_EQUALS("int ( ^ block ) ( void ) = asm ( \"^{staticinttest=0;returntest;}\" )\n\n\n;",
1119-
tokenizeAndStringify("int(^block)(void) = ^{\n"
1103+
ASSERT_THROW(ASSERT_EQUALS("void f ( ) { asm ( \"^{}\" ) ; }", tokenizeAndStringify("void f() { ^{} }")), InternalError);
1104+
ASSERT_THROW(ASSERT_EQUALS("void f ( ) { x ( asm ( \"^{}\" ) ) ; }", tokenizeAndStringify("void f() { x(^{}); }")), InternalError);
1105+
ASSERT_THROW(ASSERT_EQUALS("void f ( ) { foo ( A ( ) , asm ( \"^{bar();}\" ) ) ; }", tokenizeAndStringify("void f() { foo(A(), ^{ bar(); }); }")), InternalError);
1106+
ASSERT_THROW(ASSERT_EQUALS("int f0 ( Args args ) { asm ( \"asm(\"return^{returnsizeof...(Args);}()\")+^{returnsizeof...(args);}()\" )\n"
1107+
"2:\n"
1108+
"|\n"
1109+
"5:\n"
1110+
"6: ;\n"
1111+
"} ;", tokenizeAndStringify("int f0(Args args) {\n"
1112+
" return ^{\n"
1113+
" return sizeof...(Args);\n"
1114+
" }() + ^ {\n"
1115+
" return sizeof...(args);\n"
1116+
" }();\n"
1117+
"};")), InternalError);
1118+
ASSERT_THROW(ASSERT_EQUALS("int ( ^ block ) ( void ) = asm ( \"^{staticinttest=0;returntest;}\" )\n\n\n;",
1119+
tokenizeAndStringify("int(^block)(void) = ^{\n"
11201120
" static int test = 0;\n"
11211121
" return test;\n"
1122-
"};"));
1122+
"};")), InternalError);
11231123

1124-
ASSERT_EQUALS("; return f ( a [ b = c ] , asm ( \"^{}\" ) ) ;",
1125-
tokenizeAndStringify("; return f(a[b=c],^{});")); // #7185
1124+
ASSERT_THROW(ASSERT_EQUALS("; return f ( a [ b = c ] , asm ( \"^{}\" ) ) ;",
1125+
tokenizeAndStringify("; return f(a[b=c],^{});")), InternalError); // #7185
11261126
ASSERT_EQUALS("; return f ( asm ( \"^(void){somecode}\" ) ) ;",
11271127
tokenizeAndStringify("; return f(^(void){somecode});"));
1128-
ASSERT_EQUALS("; asm ( \"a?(b?(c,asm(\"^{}\")):0):^{}\" ) ;",
1129-
tokenizeAndStringify(";a?(b?(c,^{}):0):^{};"));
1128+
ASSERT_THROW(ASSERT_EQUALS("; asm ( \"a?(b?(c,asm(\"^{}\")):0):^{}\" ) ;",
1129+
tokenizeAndStringify(";a?(b?(c,^{}):0):^{};")), InternalError);
11301130
ASSERT_EQUALS("template < typename T > "
11311131
"CImg < T > operator| ( const char * const expression , const CImg < T > & img ) { "
11321132
"return img | expression ; "

0 commit comments

Comments
 (0)