mirror of https://github.com/boa-dev/boa.git
Browse Source
* object.hasOwnProperty should call getOwnProperty * should work for properties with undefined and null values * cargo fmtpull/455/head
n14little
5 years ago
committed by
GitHub
2 changed files with 35 additions and 6 deletions
@ -0,0 +1,22 @@
|
||||
use crate::{exec::Interpreter, forward, realm::Realm}; |
||||
|
||||
#[test] |
||||
fn object_has_own_property() { |
||||
let realm = Realm::create(); |
||||
let mut engine = Interpreter::new(realm); |
||||
let init = r#" |
||||
let x = { someProp: 1, undefinedProp: undefined, nullProp: null }; |
||||
"#; |
||||
|
||||
eprintln!("{}", forward(&mut engine, init)); |
||||
assert_eq!(forward(&mut engine, "x.hasOwnProperty('someProp')"), "true"); |
||||
assert_eq!( |
||||
forward(&mut engine, "x.hasOwnProperty('undefinedProp')"), |
||||
"true" |
||||
); |
||||
assert_eq!(forward(&mut engine, "x.hasOwnProperty('nullProp')"), "true"); |
||||
assert_eq!( |
||||
forward(&mut engine, "x.hasOwnProperty('hasOwnProperty')"), |
||||
"false" |
||||
); |
||||
} |
Loading…
Reference in new issue