mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-30 19:24:12 +01:00 
			
		
		
		
	Add tests for early errors in module syntax
Introduce the `module` flag to unambiguously identify tests that are intended to be interpreted as module code.
This commit is contained in:
		
							parent
							
								
									21b739f1dc
								
							
						
					
					
						commit
						b8b462316b
					
				| @ -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] | ||||
|  | ||||
							
								
								
									
										12
									
								
								test/language/import/dup-bound-names.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								test/language/import/dup-bound-names.js
									
									
									
									
									
										Normal file
									
								
							| @ -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'; | ||||
							
								
								
									
										13
									
								
								test/language/module-code/dup-export-decl.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								test/language/module-code/dup-export-decl.js
									
									
									
									
									
										Normal file
									
								
							| @ -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() {} | ||||
							
								
								
									
										13
									
								
								test/language/module-code/dup-export-dflt.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								test/language/module-code/dup-export-dflt.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
							
								
								
									
										14
									
								
								test/language/module-code/dup-export-id-as.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/dup-export-id-as.js
									
									
									
									
									
										Normal file
									
								
							| @ -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 }; | ||||
							
								
								
									
										14
									
								
								test/language/module-code/dup-export-id.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/dup-export-id.js
									
									
									
									
									
										Normal file
									
								
							| @ -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 }; | ||||
							
								
								
									
										14
									
								
								test/language/module-code/dup-lables.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/dup-lables.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
| } | ||||
							
								
								
									
										14
									
								
								test/language/module-code/dup-lex.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/dup-lex.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
							
								
								
									
										13
									
								
								test/language/module-code/export-unresolvable.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								test/language/module-code/export-unresolvable.js
									
									
									
									
									
										Normal file
									
								
							| @ -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 }; | ||||
							
								
								
									
										14
									
								
								test/language/module-code/import-as-stmt-list-item.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/import-as-stmt-list-item.js
									
									
									
									
									
										Normal file
									
								
							| @ -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'; | ||||
| } | ||||
							
								
								
									
										13
									
								
								test/language/module-code/lex-and-var.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								test/language/module-code/lex-and-var.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
							
								
								
									
										11
									
								
								test/language/module-code/new-target.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/language/module-code/new-target.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
							
								
								
									
										11
									
								
								test/language/module-code/super.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/language/module-code/super.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
							
								
								
									
										14
									
								
								test/language/module-code/undef-break.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/undef-break.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
| } | ||||
							
								
								
									
										14
									
								
								test/language/module-code/undef-continue.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/language/module-code/undef-continue.js
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user