restructure test directory
This commit is contained in:
1
test/fixtures/syntax/array-comprehension/multiple-if/actual.js
vendored
Normal file
1
test/fixtures/syntax/array-comprehension/multiple-if/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var seattlers = [for (customers of countries) for (c of customers) if (c.city == "Seattle") { name: c.name, age: c.age }];
|
||||
14
test/fixtures/syntax/array-comprehension/multiple-if/expected.js
vendored
Normal file
14
test/fixtures/syntax/array-comprehension/multiple-if/expected.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var seattlers = function () {
|
||||
var _arr = [];
|
||||
countries.forEach(function (customers) {
|
||||
customers.forEach(function (c) {
|
||||
if (c.city == "Seattle") {
|
||||
_arr.push({
|
||||
name: c.name,
|
||||
age: c.age
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
return _arr;
|
||||
}();
|
||||
1
test/fixtures/syntax/array-comprehension/multiple/actual.js
vendored
Normal file
1
test/fixtures/syntax/array-comprehension/multiple/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var arr = [for (x of "abcdefgh".split("")) for (y of "12345678".split("")) (x + y)];
|
||||
11
test/fixtures/syntax/array-comprehension/multiple/expected.js
vendored
Normal file
11
test/fixtures/syntax/array-comprehension/multiple/expected.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var arr = (function () {
|
||||
var _arr = [];
|
||||
|
||||
"abcdefgh".split("").forEach(function (x) {
|
||||
"12345678".split("").forEach(function (y) {
|
||||
_arr.push(x + y);
|
||||
});
|
||||
});
|
||||
|
||||
return _arr;
|
||||
})();
|
||||
1
test/fixtures/syntax/array-comprehension/no-in/actual.js
vendored
Normal file
1
test/fixtures/syntax/array-comprehension/no-in/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var arr = [for (i in [1, 2, 3]) i * i];
|
||||
3
test/fixtures/syntax/array-comprehension/no-in/options.json
vendored
Normal file
3
test/fixtures/syntax/array-comprehension/no-in/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "for-in array comprehension is not supported"
|
||||
}
|
||||
1
test/fixtures/syntax/array-comprehension/single-if/actual.js
vendored
Normal file
1
test/fixtures/syntax/array-comprehension/single-if/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var seattlers = [for (c of customers) if (c.city == "Seattle") { name: c.name, age: c.age }];
|
||||
8
test/fixtures/syntax/array-comprehension/single-if/expected.js
vendored
Normal file
8
test/fixtures/syntax/array-comprehension/single-if/expected.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var seattlers = customers.filter(function (c) {
|
||||
return c.city == "Seattle";
|
||||
}).map(function (c) {
|
||||
return {
|
||||
name: c.name,
|
||||
age: c.age
|
||||
};
|
||||
});
|
||||
1
test/fixtures/syntax/array-comprehension/single/actual.js
vendored
Normal file
1
test/fixtures/syntax/array-comprehension/single/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var arr = [for (i of [1, 2, 3]) i * i];
|
||||
3
test/fixtures/syntax/array-comprehension/single/expected.js
vendored
Normal file
3
test/fixtures/syntax/array-comprehension/single/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var arr = [1, 2, 3].map(function (i) {
|
||||
return i * i;
|
||||
});
|
||||
Reference in New Issue
Block a user