29 lines
905 B
C++
29 lines
905 B
C++
|
#ifdef TESTS_BUILD
|
||
|
#include <catch.hpp>
|
||
|
#include <sstream>
|
||
|
|
||
|
#include "../src/Binder/BoundStatements/BoundStatement.hpp"
|
||
|
using namespace Porygon::Binder;
|
||
|
|
||
|
TEST_CASE( "Bad Statement To String", "[BoundTreeString]" ) {
|
||
|
std::stringstream stream;
|
||
|
auto s = new BoundBadStatement();
|
||
|
s->GetTreeString(stream, 1);
|
||
|
REQUIRE(stream.str() == "\tBadStatement");
|
||
|
}
|
||
|
|
||
|
TEST_CASE( "Break Statement To String", "[BoundTreeString]" ) {
|
||
|
std::stringstream stream;
|
||
|
auto s = new BoundBreakStatement();
|
||
|
s->GetTreeString(stream, 1);
|
||
|
REQUIRE(stream.str() == "\tBreakStatement");
|
||
|
}
|
||
|
|
||
|
TEST_CASE( "Block Statement To String", "[BoundTreeString]" ) {
|
||
|
std::stringstream stream;
|
||
|
auto s = new BoundBlockStatement({new BoundBreakStatement(), new BoundBreakStatement()});
|
||
|
s->GetTreeString(stream, 1);
|
||
|
REQUIRE(stream.str() == "\tBlockStatement\n\t\tBreakStatement\n\t\tBreakStatement");
|
||
|
}
|
||
|
|
||
|
#endif
|