PorygonLang/tests/integration/BoundTreeStringTests.cpp

21 lines
720 B
C++

#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 (numeric (Known integer))\n"
"\t\t\tLiteralInteger: 10 (numeric (Known integer))\n"
"\t\t\tLiteralInteger: 500 (numeric (Known integer))");
delete script;
}
#endif