add array comprehension this and arguments tests
This commit is contained in:
parent
b18d1a79f4
commit
91dd5c67a4
5
test/fixtures/syntax/array-comprehension/arguments/actual.js
vendored
Normal file
5
test/fixtures/syntax/array-comprehension/arguments/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
function add() {
|
||||
return [for (i of [1, 2, 3]) i * arguments[0]];
|
||||
}
|
||||
|
||||
add(5);
|
||||
8
test/fixtures/syntax/array-comprehension/arguments/expected.js
vendored
Normal file
8
test/fixtures/syntax/array-comprehension/arguments/expected.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
function add() {
|
||||
var _arguments = arguments;
|
||||
return [1, 2, 3].map(function () {
|
||||
return i * _arguments[0];
|
||||
});
|
||||
}
|
||||
|
||||
add(5);
|
||||
5
test/fixtures/syntax/array-comprehension/this/actual.js
vendored
Normal file
5
test/fixtures/syntax/array-comprehension/this/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
function add() {
|
||||
return [for (i of [1, 2, 3]) i * this.multiplier];
|
||||
}
|
||||
|
||||
add.call({ multiplier: 5 });
|
||||
8
test/fixtures/syntax/array-comprehension/this/expected.js
vendored
Normal file
8
test/fixtures/syntax/array-comprehension/this/expected.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
function add() {
|
||||
var _this = this;
|
||||
return [1, 2, 3].map(function () {
|
||||
return i * _this.multiplier;
|
||||
});
|
||||
}
|
||||
|
||||
add.call({ multiplier: 5 });
|
||||
Loading…
x
Reference in New Issue
Block a user