|
|
@ -1,9 +1,9 @@ |
|
|
|
extern crate boa; |
|
|
|
extern crate boa; |
|
|
|
use boa::js::value::*; |
|
|
|
use boa::js::value::{ToValue, ValueData}; |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn check_is_object() { |
|
|
|
fn check_is_object() { |
|
|
|
let val = Value::new_obj(None); |
|
|
|
let val = ValueData::new_obj(None); |
|
|
|
assert_eq!(val.is_object(), true); |
|
|
|
assert_eq!(val.is_object(), true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -17,14 +17,14 @@ fn check_string_to_value() { |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn check_undefined() { |
|
|
|
fn check_undefined() { |
|
|
|
let u = Value::undefined(); |
|
|
|
let u = ValueData::Undefined; |
|
|
|
assert_eq!(u.get_type(), "undefined"); |
|
|
|
assert_eq!(u.get_type(), "undefined"); |
|
|
|
assert_eq!(u.to_string(), "undefined"); |
|
|
|
assert_eq!(u.to_string(), "undefined"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn check_get_set_field() { |
|
|
|
fn check_get_set_field() { |
|
|
|
let obj = Value::new_obj(None); |
|
|
|
let obj = ValueData::new_obj(None); |
|
|
|
// Create string and convert it to a Value
|
|
|
|
// Create string and convert it to a Value
|
|
|
|
let s = String::from("bar").to_value(); |
|
|
|
let s = String::from("bar").to_value(); |
|
|
|
obj.set_field_slice("foo", s); |
|
|
|
obj.set_field_slice("foo", s); |
|
|
|