mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
fix: 绑定 Function 和 Object prototype harness helper
This commit is contained in:
@@ -30,6 +30,25 @@ fn function_bind_creates_wrapper() {
|
||||
assert!((result.as_double() - 5.0).abs() < 0.0001);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn function_constructor_is_global() {
|
||||
let mut vm = Vm::new();
|
||||
let result = eval(&mut vm, "typeof Function").unwrap();
|
||||
let rendered = vm.kernel().string_forge().lookup(result.as_string_index()).unwrap_or_default();
|
||||
assert_eq!(rendered, "function");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn function_call_bind_supports_uncurried_native_methods() {
|
||||
let mut vm = Vm::new();
|
||||
let result = eval(
|
||||
&mut vm,
|
||||
"var __push = Function.prototype.call.bind(Array.prototype.push); var a = []; __push(a, 'x'); a.length",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(result, JsValue::int(1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn function_call_invokes_bytecode_function() {
|
||||
let mut vm = Vm::new();
|
||||
|
||||
Reference in New Issue
Block a user