Files
interpreter-cpp/test/parser/return.cpp
Karma Riuk c943380d58 moved the utils for the parser to a global utils
folder for the tests (that utils is includable
only by the tests and not the src code, I added a
compiler flag only for the tests in the makefile,
but the compiler_flags.txt is global for the lsp,
gotta be careful with that)
2025-07-19 13:27:25 +02:00

22 lines
463 B
C++

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