提交 9dcc9bb5 编写于 作者: A Andrew Scheidecker 提交者: Matt Witherspoon

Recognize some spec test expected errors by their message prefix instead of the full message

上级 d5aa0988
......@@ -179,6 +179,12 @@ static Action* parseAction(ParseState& state)
return result;
}
template<Uptr numPrefixChars>
static bool stringStartsWith(const char* string,const char (&prefix)[numPrefixChars])
{
return !strncmp(string,prefix,numPrefixChars - 1);
}
static Command* parseCommand(ParseState& state)
{
Command* result = nullptr;
......@@ -250,14 +256,10 @@ static Command* parseCommand(ParseState& state)
else if(!strcmp(expectedErrorMessage.c_str(),"integer overflow")) { expectedCause = Runtime::Exception::Cause::integerDivideByZeroOrIntegerOverflow; }
else if(!strcmp(expectedErrorMessage.c_str(),"integer divide by zero")) { expectedCause = Runtime::Exception::Cause::integerDivideByZeroOrIntegerOverflow; }
else if(!strcmp(expectedErrorMessage.c_str(),"invalid conversion to integer")) { expectedCause = Runtime::Exception::Cause::invalidFloatOperation; }
else if(!strcmp(expectedErrorMessage.c_str(),"unreachable executed")) { expectedCause = Runtime::Exception::Cause::reachedUnreachable; }
else if(!strcmp(expectedErrorMessage.c_str(),"unreachable")) { expectedCause = Runtime::Exception::Cause::reachedUnreachable; }
else if(!strcmp(expectedErrorMessage.c_str(),"indirect call signature mismatch")) { expectedCause = Runtime::Exception::Cause::indirectCallSignatureMismatch; }
else if(!strcmp(expectedErrorMessage.c_str(),"indirect call")) { expectedCause = Runtime::Exception::Cause::indirectCallSignatureMismatch; }
else if(!strcmp(expectedErrorMessage.c_str(),"undefined element")) { expectedCause = Runtime::Exception::Cause::undefinedTableElement; }
else if(!strcmp(expectedErrorMessage.c_str(),"undefined")) { expectedCause = Runtime::Exception::Cause::undefinedTableElement; }
else if(!strcmp(expectedErrorMessage.c_str(),"uninitialized")) { expectedCause = Runtime::Exception::Cause::undefinedTableElement; }
else if(!strcmp(expectedErrorMessage.c_str(),"uninitialized element")) { expectedCause = Runtime::Exception::Cause::undefinedTableElement; }
else if(stringStartsWith(expectedErrorMessage.c_str(),"unreachable")) { expectedCause = Runtime::Exception::Cause::reachedUnreachable; }
else if(stringStartsWith(expectedErrorMessage.c_str(),"indirect call")) { expectedCause = Runtime::Exception::Cause::indirectCallSignatureMismatch; }
else if(stringStartsWith(expectedErrorMessage.c_str(),"undefined")) { expectedCause = Runtime::Exception::Cause::undefinedTableElement; }
else if(stringStartsWith(expectedErrorMessage.c_str(),"uninitialized")) { expectedCause = Runtime::Exception::Cause::undefinedTableElement; }
result = new AssertTrapCommand(std::move(locus),action,expectedCause);
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册