29 lines
973 B
Rust
29 lines
973 B
Rust
use prometeu_hal::vm_fault::VmFault;
|
|
use prometeu_vm::VirtualMachine;
|
|
use prometeu_vm::{HostContext, HostReturn, NativeInterface, SyscallId};
|
|
|
|
#[test]
|
|
fn gc_collects_unreachable_closure_but_keeps_marked() {
|
|
// Black-box check: a fresh VM with no program initializes and can run a zero-budget slice.
|
|
// The GC behavior is covered by unit tests inside the VM crate; this layer test remains
|
|
// as a smoke-test for public API stability.
|
|
struct NoopNative;
|
|
impl NativeInterface for NoopNative {
|
|
fn syscall(
|
|
&mut self,
|
|
_id: SyscallId,
|
|
_args: &[prometeu_bytecode::Value],
|
|
_ret: &mut HostReturn,
|
|
_ctx: &mut HostContext,
|
|
) -> Result<(), VmFault> {
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
let mut vm = VirtualMachine::default();
|
|
let mut native = NoopNative;
|
|
let mut ctx = HostContext::new(None);
|
|
let res = vm.run_budget(0, &mut native, &mut ctx);
|
|
assert!(res.is_ok());
|
|
}
|