Support for retrieving bound tree string from script objecsts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-09-07 12:12:37 +02:00
parent acc687f213
commit da4258506e
3 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#ifdef TESTS_BUILD
#include <catch.hpp>
#include "../src/Script.hpp"
using namespace Porygon;
TEST_CASE( "Basic script to bound tree string", "[integration]" ) {
Script* script = Script::Create("return 10 + 500");
REQUIRE(!script->Diagnostics -> HasErrors());
auto boundTreeString = script->GetTreeString();
REQUIRE(boundTreeString == "BlockStatement\n"
"\tReturnStatement\n"
"\t\tBinaryExpression: addition (number)\n"
"\t\t\tLiteralInteger: 10 (number)\n"
"\t\t\tLiteralInteger: 500 (number)");
delete script;
}
#endif