feat: udpate boa test
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
use boa::Context;
|
||||
use boa::{Context, Result, Value};
|
||||
|
||||
fn main() {
|
||||
let mut context = Context::new();
|
||||
context.register_global_function("print", 0, print).unwrap();
|
||||
let script = r##"
|
||||
function helloworld() {
|
||||
console.log('hello world');
|
||||
print(1, 2, 3);
|
||||
}
|
||||
helloworld();
|
||||
"hello world!!!"
|
||||
@@ -12,3 +14,9 @@ fn main() {
|
||||
let v = context.eval(script).expect("Eval failed!");
|
||||
println!("{:?}", v);
|
||||
}
|
||||
|
||||
|
||||
fn print(_: &Value, args: &[Value], _: &mut Context) -> Result<Value> {
|
||||
println!("[PRINT] {:?}", args);
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
Reference in New Issue
Block a user