diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c75ca8b28930488a156c8d0e64b5571f3a9b45d1..d3b6c84f87366bbcd3a1d7679b583e54f4d0e059 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -115,6 +115,8 @@ This tag is for boolean properties associated with the test. - **`onlyStrict`** - only run the test in strict mode (*not supported by the browser runner*) - **`noStrict`** - only run the test in "sloppy" mode +- **`module`** - interpret the source text as [module + code](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-modules) #### features **features**: [list] diff --git a/test/language/import/dup-bound-names.js b/test/language/import/dup-bound-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ffad6f4e95b095a6116fddfb9f4f93baafeca29a --- /dev/null +++ b/test/language/import/dup-bound-names.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if the BoundNames of ImportDeclaration contains any + duplicate entries. +flags: [module] +negative: SyntaxError +---*/ + +import { x, y as x } from 'z'; diff --git a/test/language/module-code/dup-export-decl.js b/test/language/module-code/dup-export-decl.js new file mode 100644 index 0000000000000000000000000000000000000000..11ad18500c9ddfba5b7a3fd5793dd7a3cef0400e --- /dev/null +++ b/test/language/module-code/dup-export-decl.js @@ -0,0 +1,13 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if the ExportedNames of ModuleItemList contains any + duplicate entries. +flags: [module] +negative: SyntaxError +---*/ + +export function f() {} +export function *f() {} diff --git a/test/language/module-code/dup-export-dflt.js b/test/language/module-code/dup-export-dflt.js new file mode 100644 index 0000000000000000000000000000000000000000..7acb62a9dd7666e138170de0bace29972cc1b654 --- /dev/null +++ b/test/language/module-code/dup-export-dflt.js @@ -0,0 +1,13 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if the ExportedNames of ModuleItemList contains any + duplicate entries. +flags: [module] +negative: SyntaxError +---*/ + +export default var x = null; +export default var x = null; diff --git a/test/language/module-code/dup-export-id-as.js b/test/language/module-code/dup-export-id-as.js new file mode 100644 index 0000000000000000000000000000000000000000..7bf78a27525378063d5a6ae4fd18e2f326ce1e85 --- /dev/null +++ b/test/language/module-code/dup-export-id-as.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if the ExportedNames of ModuleItemList contains any + duplicate entries. +flags: [module] +negative: SyntaxError +---*/ + +var x, y; +export { x as z }; +export { y as z }; diff --git a/test/language/module-code/dup-export-id.js b/test/language/module-code/dup-export-id.js new file mode 100644 index 0000000000000000000000000000000000000000..65ae1ceecc09c4eb9cecf8d23257f45cac8c4b21 --- /dev/null +++ b/test/language/module-code/dup-export-id.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if the ExportedNames of ModuleItemList contains any + duplicate entries. +flags: [module] +negative: SyntaxError +---*/ + +var x; +export { x }; +export { x }; diff --git a/test/language/module-code/dup-lables.js b/test/language/module-code/dup-lables.js new file mode 100644 index 0000000000000000000000000000000000000000..3dd2e5f039f750cba688bcac5b0d735733c799df --- /dev/null +++ b/test/language/module-code/dup-lables.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if ContainsDuplicateLabels of ModuleItemList with + argument « » is true. +flags: [module] +negative: SyntaxError +---*/ + +label: { + label: 0; +} diff --git a/test/language/module-code/dup-lex.js b/test/language/module-code/dup-lex.js new file mode 100644 index 0000000000000000000000000000000000000000..766795c3bd13803f51736412a88db0fa212c4e65 --- /dev/null +++ b/test/language/module-code/dup-lex.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 10.2.1 +description: > + It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList + contains any duplicate entries. +flags: [module] +features: [let, const] +negative: SyntaxError +---*/ + +let x; +const x; diff --git a/test/language/module-code/export-unresolvable.js b/test/language/module-code/export-unresolvable.js new file mode 100644 index 0000000000000000000000000000000000000000..fccb3cf62fdd54aeee19522b978708b246fc062d --- /dev/null +++ b/test/language/module-code/export-unresolvable.js @@ -0,0 +1,13 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if any element of the ExportedBindings of + ModuleItemList does not also occur in either the VarDeclaredNames of + ModuleItemList, or the LexicallyDeclaredNames of ModuleItemList. +flags: [module] +negative: SyntaxError +---*/ + +export { unresolvable }; diff --git a/test/language/module-code/import-as-stmt-list-item.js b/test/language/module-code/import-as-stmt-list-item.js new file mode 100644 index 0000000000000000000000000000000000000000..4cb68de6d796e21f6f1e41888cd125615d220298 --- /dev/null +++ b/test/language/module-code/import-as-stmt-list-item.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2 +description: > + An ImportDeclaration is not a valid StatementListItem and is therefore + restricted from appearing within statements in a ModuleBody. +flags: [module] +negative: SyntaxError +---*/ + +{ + import { x } from 'y'; +} diff --git a/test/language/module-code/lex-and-var.js b/test/language/module-code/lex-and-var.js new file mode 100644 index 0000000000000000000000000000000000000000..6e269e6310037d693d2a225e89ae12c6af06d1ef --- /dev/null +++ b/test/language/module-code/lex-and-var.js @@ -0,0 +1,13 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 10.2.1 +description: > + It is a Syntax Error if any element of the LexicallyDeclaredNames of + ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. +flags: [module] +features: [let] +---*/ + +let x; +var x; diff --git a/test/language/module-code/new-target.js b/test/language/module-code/new-target.js new file mode 100644 index 0000000000000000000000000000000000000000..805d94ffae36708857c786bf457c58215c29a28f --- /dev/null +++ b/test/language/module-code/new-target.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if ModuleItemList Contains NewTarget +flags: [module] +negative: SyntaxError +---*/ + +new.target; diff --git a/test/language/module-code/super.js b/test/language/module-code/super.js new file mode 100644 index 0000000000000000000000000000000000000000..ea787f1bece82c598b1a41d5a9490dfc14f4e748 --- /dev/null +++ b/test/language/module-code/super.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if ModuleItemList Contains super. +flags: [module] +negative: SyntaxError +---*/ + +super; diff --git a/test/language/module-code/undef-break.js b/test/language/module-code/undef-break.js new file mode 100644 index 0000000000000000000000000000000000000000..e1b828fbeb489be9288155e590e47bb9d51fd31b --- /dev/null +++ b/test/language/module-code/undef-break.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if ContainsUndefinedBreakTarget of ModuleItemList with + argument « » is true. +flags: [module] +negative: SyntaxError +---*/ + +while (false) { + break undef; +} diff --git a/test/language/module-code/undef-continue.js b/test/language/module-code/undef-continue.js new file mode 100644 index 0000000000000000000000000000000000000000..e6e0457293d7c6e36f1f5d34da6c1fa3723a18ac --- /dev/null +++ b/test/language/module-code/undef-continue.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 15.2.1.1 +description: > + It is a Syntax Error if ContainsUndefinedContinueTarget of ModuleItemList + with arguments « » and « » is true. +flags: [module] +negative: SyntaxError +---*/ + +while (false) { + continue undef; +}