fixed text runner

This commit is contained in:
2026-02-07 10:51:27 -06:00
parent fbb7933eb6
commit 555cceb9d6
2 changed files with 22 additions and 13 deletions

View File

@@ -33267,11 +33267,14 @@ static JSValue JS_CallRegisterVM(JSContext *ctx, JSCodeRegister *code,
JSValue arr = frame->slots[a];
JSValue val = frame->slots[b];
if (!JS_IsArray(arr)) goto disrupt;
JSValue arr_ref = arr;
int rc = JS_ArrayPush(ctx, &arr_ref, val);
JSGCRef arr_gc;
JS_PushGCRef(ctx, &arr_gc);
arr_gc.val = arr;
int rc = JS_ArrayPush(ctx, &arr_gc.val, val);
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
JS_PopGCRef(ctx, &arr_gc);
if (rc < 0) goto disrupt;
if (arr_ref != arr) frame->slots[a] = arr_ref;
if (arr_gc.val != arr) frame->slots[a] = arr_gc.val;
break;
}

View File

@@ -4,27 +4,33 @@
var passed = 0
var failed = 0
var errors = []
var error_names = []
var error_reasons = []
var fail_msg = ""
// pre-allocate 500 slots to avoid array growth during disruption handlers
for (var _i = 0; _i < 500; _i++) {
error_names[] = null
error_reasons[] = null
}
var fail = function(msg) {
fail_msg = msg
print("failed: " + msg)
disrupt
}
var assert_eq = function(actual, expected, msg) {
if (actual != expected) fail(msg + " (expected=" + text(expected) + " got=" + text(actual) + ")")
if (actual != expected) fail(msg + " (got=" + text(actual) + ")")
}
var run = function(name, fn) {
fail_msg = ""
fn()
passed = passed + 1
print("passed " + name)
} disruption {
error_names[failed] = name
error_reasons[failed] = fail_msg == "" ? "disruption" : fail_msg
failed = failed + 1
errors[] = name
}
var should_disrupt = function(fn) {
@@ -3367,10 +3373,10 @@ run("gc object from keys function under pressure", function() {
// SUMMARY
// ============================================================================
print(`\nResults: ${passed} passed, ${failed} failed out of ${passed + failed}`)
print(text(passed) + " passed, " + text(failed) + " failed out of " + text(passed + failed))
if (failed > 0) {
print("Failed tests:")
arrfor(errors, function(name) {
print(` - ${name}`)
})
print("")
for (var _j = 0; _j < failed; _j++) {
print(" FAIL " + error_names[_j] + ": " + error_reasons[_j])
}
}