diff options
Diffstat (limited to 'tools/node_modules/expresso/deps/jscoverage/tests/javascript/javascript-destructuring.js')
-rw-r--r-- | tools/node_modules/expresso/deps/jscoverage/tests/javascript/javascript-destructuring.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/node_modules/expresso/deps/jscoverage/tests/javascript/javascript-destructuring.js b/tools/node_modules/expresso/deps/jscoverage/tests/javascript/javascript-destructuring.js new file mode 100644 index 0000000..c8cf4c9 --- /dev/null +++ b/tools/node_modules/expresso/deps/jscoverage/tests/javascript/javascript-destructuring.js @@ -0,0 +1,42 @@ +// https://developer.mozilla.org/en/New_in_JavaScript_1.7 + +[a, b] = [b, a]; + +function f() { + return [1, 2]; +} +[a, b] = f(); + +for (let [name, value] in Iterator(obj)) { + print(name); + print(value); +} + +for each (let {name: n, family: { father: f } } in people) { + print(n); + print(f); +} + +var [a, , b] = f(); +[,,,] = f(); + +function g() { + var parsedURL = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url); + if (!parsedURL) + return null; + var [, protocol, fullhost, fullpath] = parsedURL; +} + +function h(a, [b, c], {foo: d, 'bar': e}) { + f(); + g(); +} + +x = function([a, b]) a + b; + +({x: x0, y: y0}) = point; +var {x: x0, y: y0} = point; +let ({x: x0, y: y0} = point) { + print(x0); + print(y0); +} |