2019-09-07 10:12:37 +00:00
|
|
|
#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"
|
2019-09-22 15:41:18 +00:00
|
|
|
"\t\tBinaryExpression: addition (numeric (Known integer))\n"
|
|
|
|
"\t\t\tLiteralInteger: 10 (numeric (Known integer))\n"
|
|
|
|
"\t\t\tLiteralInteger: 500 (numeric (Known integer))");
|
2019-09-07 10:12:37 +00:00
|
|
|
delete script;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|