Browse Source

fixed tests and updated readme

pull/5/head
Jason Williams 6 years ago
parent
commit
cd2208c150
  1. 2
      README.md
  2. 6
      tests/js/test.js
  3. 8
      tests/value_test.rs

2
README.md

@ -11,4 +11,4 @@ This project is an attempted rewrite of Bebbington's js.rs and will look very, v
* Checkout this project * Checkout this project
* Build `cargo build` * Build `cargo build`
* `cargo run` * `cargo run`
* You can make changes to tests/js/defineVar.js and build again * You can make changes to tests/js/test.js and build again

6
tests/js/test.js

@ -1,3 +1,3 @@
var a = 1; var a = "jason";
var b = 2; var b = 1;
b + a; a + b;

8
tests/value_test.rs

@ -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);

Loading…
Cancel
Save