PorygonLang/tests/integration/BoundTreeStringTests.cpp

21 lines
669 B
C++
Raw Normal View History

#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