2019-05-28 15:49:03 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#include <catch.hpp>
|
|
|
|
#include "../src/Script.hpp"
|
|
|
|
|
|
|
|
TEST_CASE( "Create script variable", "[integration]" ) {
|
|
|
|
Script* script = Script::Create("foo = true");
|
|
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
|
|
auto variable = script->GetVariable("foo");
|
|
|
|
REQUIRE(variable == nullptr);
|
2019-05-29 12:55:03 +00:00
|
|
|
script->Evaluate();
|
|
|
|
variable = script->GetVariable("foo");
|
|
|
|
REQUIRE(variable != nullptr);
|
|
|
|
REQUIRE(variable->EvaluateBool());
|
2019-05-28 16:50:23 +00:00
|
|
|
delete script;
|
2019-05-28 15:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|