mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Be sure to verify the opcode got executed
This commit is contained in:
parent
6ad8549163
commit
be759e576a
@ -346,23 +346,28 @@ End)mwscript";
|
|||||||
TEST_F(MWScriptTest, mwscript_test_function)
|
TEST_F(MWScriptTest, mwscript_test_function)
|
||||||
{
|
{
|
||||||
registerExtensions();
|
registerExtensions();
|
||||||
|
bool failed = true;
|
||||||
if(auto script = compile(sScript2))
|
if(auto script = compile(sScript2))
|
||||||
{
|
{
|
||||||
class AddTopic : public Interpreter::Opcode0
|
class AddTopic : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
|
bool& mFailed;
|
||||||
public:
|
public:
|
||||||
|
AddTopic(bool& failed) : mFailed(failed) {}
|
||||||
|
|
||||||
void execute(Interpreter::Runtime& runtime)
|
void execute(Interpreter::Runtime& runtime)
|
||||||
{
|
{
|
||||||
const auto topic = runtime.getStringLiteral(runtime[0].mInteger);
|
const auto topic = runtime.getStringLiteral(runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
mFailed = false;
|
||||||
EXPECT_EQ(topic, "OpenMW Unit Test");
|
EXPECT_EQ(topic, "OpenMW Unit Test");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
installOpcode(Compiler::Dialogue::opcodeAddTopic, new AddTopic);
|
installOpcode(Compiler::Dialogue::opcodeAddTopic, new AddTopic(failed));
|
||||||
TestInterpreterContext context;
|
TestInterpreterContext context;
|
||||||
run(*script, context);
|
run(*script, context);
|
||||||
}
|
}
|
||||||
else
|
if(failed)
|
||||||
{
|
{
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user