mirror of https://github.com/tc39/test262.git
Merge pull request #300 from bocoup/modules-early-errors
Add tests for early errors in module syntax
This commit is contained in:
commit
32edc4873e
|
@ -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*)
|
- **`onlyStrict`** - only run the test in strict mode (*not supported by the browser runner*)
|
||||||
- **`noStrict`** - only run the test in "sloppy" mode
|
- **`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
|
||||||
**features**: [list]
|
**features**: [list]
|
||||||
|
|
|
@ -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';
|
|
@ -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() {}
|
|
@ -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;
|
|
@ -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 };
|
|
@ -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 };
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
|
@ -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 };
|
|
@ -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';
|
||||||
|
}
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
||||||
|
}
|
|
@ -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…
Reference in New Issue