fix parser tests

update exception messages
This commit is contained in:
alexlamsl
2017-02-28 03:58:01 +08:00
parent a0eaff750d
commit a942dc07c4
12 changed files with 30 additions and 31 deletions

View File

@@ -248,18 +248,18 @@ describe("Left-hand side expressions", function () {
}
// Spreads are not allowed in destructuring array if it's not the last element
expect("[...a, ...b] = [1, 2, 3, 4]", "SyntaxError: Spread must the be last element in destructuring array");
expect("[...a, ...b] = [1, 2, 3, 4]", "Spread must the be last element in destructuring array");
// Multiple spreads are not allowed in destructuring array
expect("[...a, ...b] = [1, 2, 3, 4]", "SyntaxError: Spread must the be last element in destructuring array");
expect("[...a, ...b] = [1, 2, 3, 4]", "Spread must the be last element in destructuring array");
// Spread in obvious object pattern
expect("({...a} = foo)", "SyntaxError: Unexpected token: expand (...)");
expect("({...a} = foo)", "Unexpected token: expand (...)");
// Spread in block should not be allowed
expect("{...a} = foo", "SyntaxError: Unexpected token: expand (...)");
expect("{...a} = foo", "Unexpected token: expand (...)");
// Not in standard yet
expect("let foo = {bar: 42}, bar; bar = {...foo}", "SyntaxError: Unexpected token: expand (...)");
expect("let foo = {bar: 42}, bar; bar = {...foo}", "Unexpected token: expand (...)");
});
});