extracted to a function the casting of the

different types to make tests cleaner
This commit is contained in:
Karma Riuk
2025-07-09 11:06:28 +02:00
parent 79b1aeb45f
commit c65cefe867
4 changed files with 98 additions and 54 deletions

View File

@@ -14,12 +14,7 @@ return 103213;\
for (const auto stmt : program->statements) {
REQUIRE(stmt->token_literal() == "return");
ast::return_stmt* let_stmt;
REQUIRE_NOTHROW(let_stmt = dynamic_cast<ast::return_stmt*>(stmt));
REQUIRE_MESSAGE(
let_stmt != nullptr,
"Couldn't cast statement to a return statement"
);
ast::return_stmt* return_stmt = cast<ast::return_stmt>(stmt);
}
}
}