mirror of https://github.com/boa-dev/boa.git
Browse Source
* Fix spread in new and call expressions * Fix formatting * Add unit tests * Fix unit test Co-authored-by: tofpie <tofpie@users.noreply.github.com>pull/1023/head
tofpie
4 years ago
committed by
GitHub
4 changed files with 62 additions and 4 deletions
@ -0,0 +1,31 @@
|
||||
use crate::exec; |
||||
|
||||
#[test] |
||||
fn spread_with_new() { |
||||
let scenario = r#" |
||||
function F(m) { |
||||
this.m = m; |
||||
} |
||||
function f(...args) { |
||||
return new F(...args); |
||||
} |
||||
let a = f('message'); |
||||
a.m; |
||||
"#; |
||||
assert_eq!(&exec(scenario), r#""message""#); |
||||
} |
||||
|
||||
#[test] |
||||
fn spread_with_call() { |
||||
let scenario = r#" |
||||
function f(m) { |
||||
return m; |
||||
} |
||||
function g(...args) { |
||||
return f(...args); |
||||
} |
||||
let a = g('message'); |
||||
a; |
||||
"#; |
||||
assert_eq!(&exec(scenario), r#""message""#); |
||||
} |
Loading…
Reference in new issue