Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
git committed Feb 13, 2021
1 parent 1b6f275 commit 8c5e372
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion boa/src/builtins/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ impl Array {
// add properties and set length
array.set_field("length", 0, context)?;
Array::add_to_array_object(&array, args, context)?;

Ok(array)
}

Expand Down
25 changes: 7 additions & 18 deletions boa/src/builtins/array/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,17 @@ fn of() {
context.eval("[]").unwrap().to_string(&mut context).unwrap()
);

context.eval(r#"let a = Array.of.call(Date, "a", undefined, 3);"#).unwrap();
context
.eval(r#"let a = Array.of.call(Date, "a", undefined, 3);"#)
.unwrap();
assert_eq!(
context.eval("a instanceof Date").unwrap(),
Value::from(true)
);
assert_eq!(
context.eval("a[0]").unwrap(),
Value::from("a")
);
assert_eq!(
context.eval("a[1]").unwrap(),
Value::undefined()
);
assert_eq!(
context.eval("a[2]").unwrap(),
Value::from(3)
);
assert_eq!(
context.eval("a.length").unwrap(),
Value::from(3)
);

assert_eq!(context.eval("a[0]").unwrap(), Value::from("a"));
assert_eq!(context.eval("a[1]").unwrap(), Value::undefined());
assert_eq!(context.eval("a[2]").unwrap(), Value::from(3));
assert_eq!(context.eval("a.length").unwrap(), Value::from(3));
}

#[ignore]
Expand Down

0 comments on commit 8c5e372

Please sign in to comment.