add traceur test suite
This commit is contained in:
25
test/fixtures/traceur/Destructuring/Array.js
vendored
Normal file
25
test/fixtures/traceur/Destructuring/Array.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
function destructArray() {
|
||||
var a, b, c, d;
|
||||
[a, [b], c, d] = ['hello', [',', 'junk'], ['world']];
|
||||
return {
|
||||
a: a,
|
||||
b: b,
|
||||
c: c,
|
||||
d: d
|
||||
};
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
var result = destructArray();
|
||||
assert.equal('hello', result.a);
|
||||
assert.equal(',', result.b);
|
||||
assertArrayEquals(['world'], result.c);
|
||||
assert.isUndefined(result.d);
|
||||
|
||||
function testNested() {
|
||||
var a;
|
||||
[[a] = ['b']] = [];
|
||||
return a;
|
||||
}
|
||||
assert.equal(testNested(), 'b');
|
||||
Reference in New Issue
Block a user