|
|
@ -1128,3 +1128,38 @@ fn check_this_binding_in_object_literal() { |
|
|
|
|
|
|
|
|
|
|
|
assert_eq!(forward(&mut engine, init), "8"); |
|
|
|
assert_eq!(forward(&mut engine, init), "8"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
|
|
|
fn not_a_function() { |
|
|
|
|
|
|
|
let realm = Realm::create(); |
|
|
|
|
|
|
|
let mut engine = Interpreter::new(realm); |
|
|
|
|
|
|
|
let init = r#" |
|
|
|
|
|
|
|
let a = {}; |
|
|
|
|
|
|
|
let b = true; |
|
|
|
|
|
|
|
"#; |
|
|
|
|
|
|
|
forward(&mut engine, init); |
|
|
|
|
|
|
|
let scenario = r#" |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
a(); |
|
|
|
|
|
|
|
} catch(e) { |
|
|
|
|
|
|
|
e.message |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
"#; |
|
|
|
|
|
|
|
assert_eq!(forward(&mut engine, scenario), "not a function"); |
|
|
|
|
|
|
|
let scenario = r#" |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
a.a(); |
|
|
|
|
|
|
|
} catch(e) { |
|
|
|
|
|
|
|
e.message |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
"#; |
|
|
|
|
|
|
|
assert_eq!(forward(&mut engine, scenario), "not a function"); |
|
|
|
|
|
|
|
let scenario = r#" |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
b(); |
|
|
|
|
|
|
|
} catch(e) { |
|
|
|
|
|
|
|
e.message |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
"#; |
|
|
|
|
|
|
|
assert_eq!(forward(&mut engine, scenario), "not a function"); |
|
|
|
|
|
|
|
} |
|
|
|