using fixtures (not super necessary, but nice)

This commit is contained in:
Karma Riuk
2025-07-08 10:58:51 +02:00
parent 2dfff61346
commit 902f5a16df
3 changed files with 30 additions and 16 deletions

View File

@@ -1,24 +1,19 @@
#include "ast/ast.hpp"
#include "lexer/lexer.hpp"
#include "parser/parser.hpp"
#include "utils.hpp"
#include <doctest.h>
#include <sstream>
TEST_SUITE("Parser: return") {
TEST_CASE("Parse return statement") {
std::stringstream input("\
TEST_CASE_FIXTURE(ParserFixture, "Parse return statement") {
setup("\
return 5;\
return 10;\
return 103213;\
");
lexer::lexer l{input};
parser::parser p{l};
ast::program* program = p.parse_program();
check_parser_errors(p.errors);
ast::program* program = p->parse_program();
check_parser_errors(p->errors);
REQUIRE_MESSAGE(
program != nullptr,