Skip to content

Commit

Permalink
Remove test for custom intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
DelSkayn committed Nov 18, 2024
1 parent 5fc0888 commit d0cb245
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions core/src/context/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,24 +162,4 @@ mod tests {
let result: usize = ctx.with(|ctx| ctx.eval("1+1")).unwrap();
assert_eq!(result, 2);
}

#[test]
fn custom_intrinsic() {
struct MyIntrinsic;

impl Intrinsic for MyIntrinsic {
unsafe fn add_intrinsic(ctx: NonNull<qjs::JSContext>) {
let ctx = crate::Ctx::from_raw(ctx);
ctx.globals().set("test", 42).unwrap();
}
}

let rt = crate::Runtime::new().unwrap();
let ctx = Context::builder()
.with::<(MyIntrinsic, intrinsic::Eval)>()
.build(&rt)
.unwrap();
let result: usize = ctx.with(|ctx| ctx.eval("test+1")).unwrap();
assert_eq!(result, 43);
}
}

0 comments on commit d0cb245

Please sign in to comment.