Files
interpreter-cpp/test/parser/return.cpp
Karma Riuk c65cefe867 extracted to a function the casting of the
different types to make tests cleaner
2025-07-09 11:07:21 +02:00

21 lines
454 B
C++

#include "utils.hpp"
#include <doctest.h>
TEST_SUITE("Parser: return") {
TEST_CASE_FIXTURE(ParserFixture, "Parse return statement") {
setup("\
return 5;\
return 10;\
return 103213;\
");
REQUIRE(program->statements.size() == 3);
for (const auto stmt : program->statements) {
REQUIRE(stmt->token_literal() == "return");
ast::return_stmt* return_stmt = cast<ast::return_stmt>(stmt);
}
}
}