add -e flag
This commit is contained in:
38
vm_suite.ce
38
vm_suite.ce
@@ -7434,11 +7434,39 @@ run("disruption propagation - runtime error direct vs nested", function() {
|
||||
}
|
||||
})
|
||||
|
||||
// BUG: invoking a non-function (e.g. `var x = 42; x()`) crashes the VM
|
||||
// instead of cleanly disrupting. The compiler warns "invoking int — will
|
||||
// always disrupt" but the generated code causes a hard crash that kills
|
||||
// the entire actor, bypassing disruption handlers.
|
||||
// Cannot add a runtime test for this without crashing the suite.
|
||||
run("disruption propagation - invoke non-function at runtime", function() {
|
||||
// Use an array to hide the type from the compiler so it can't
|
||||
// statically prove the invoke will fail. This tests the VM's
|
||||
// MACH_FRAME runtime check, not the compile-time diagnostic.
|
||||
var vals = [42, null, "hello", true]
|
||||
var i = 0
|
||||
var count = 0
|
||||
for (i = 0; i < length(vals); i++) {
|
||||
if (should_disrupt(function() { vals[i]() })) {
|
||||
count = count + 1
|
||||
}
|
||||
}
|
||||
assert_eq(count, 4, "all non-function values should disrupt when invoked")
|
||||
})
|
||||
|
||||
run("disruption propagation - invoke non-function direct handler", function() {
|
||||
// Same test but with a direct disruption handler to verify consistency.
|
||||
var vals = [42, null, "hello", true]
|
||||
var i = 0
|
||||
var count = 0
|
||||
var caught = false
|
||||
var try_call = function() {
|
||||
vals[i]()
|
||||
} disruption {
|
||||
caught = true
|
||||
}
|
||||
for (i = 0; i < length(vals); i++) {
|
||||
caught = false
|
||||
try_call()
|
||||
if (caught) count = count + 1
|
||||
}
|
||||
assert_eq(count, 4, "all non-function values should disrupt with direct handler")
|
||||
})
|
||||
|
||||
run("disruption propagation - comparison error direct vs nested", function() {
|
||||
var via_should = should_disrupt(function() {
|
||||
|
||||
Reference in New Issue
Block a user