mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-22 15:37:51 +00:00
For test runner, try to look for os.exit or os2.exit
This commit is contained in:
+18
-1
@@ -2900,7 +2900,24 @@ gb_internal lbProcedure *lb_create_main_procedure(lbModule *m, lbProcedure *star
|
||||
args[0] = lb_addr_load(p, all_tests_slice);
|
||||
lbValue result = lb_emit_call(p, runner, args);
|
||||
|
||||
lbValue exit_runner = lb_find_package_value(m, str_lit("os"), str_lit("exit"));
|
||||
lbValue exit_runner = {};
|
||||
{
|
||||
AstPackage *pkg = try_get_core_package(m->info, str_lit("os"));
|
||||
if (pkg == nullptr) {
|
||||
pkg = try_get_core_package(m->info, str_lit("os2"));
|
||||
}
|
||||
if (pkg == nullptr) {
|
||||
pkg = get_core_package(m->info, str_lit("os2"));
|
||||
}
|
||||
|
||||
String name = str_lit("exit");
|
||||
Entity *e = scope_lookup_current(pkg->scope, name);
|
||||
if (e == nullptr) {
|
||||
compiler_error("Could not find type declaration for '%.*s.%.*s'\n", LIT(pkg->name), LIT(name));
|
||||
}
|
||||
exit_runner = lb_find_value_from_entity(m, e);
|
||||
}
|
||||
|
||||
auto exit_args = array_make<lbValue>(temporary_allocator(), 1);
|
||||
exit_args[0] = lb_emit_select(p, result, lb_const_int(m, t_int, 0), lb_const_int(m, t_int, 1));
|
||||
lb_emit_call(p, exit_runner, exit_args, ProcInlining_none);
|
||||
|
||||
Reference in New Issue
Block a user