Skip to content
Snippets Groups Projects
Commit b8b46231 authored by Mike Pennisi's avatar Mike Pennisi
Browse files

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.
parent 21b739f1
No related branches found
No related tags found
No related merge requests found
Showing
with 186 additions and 0 deletions
......@@ -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]
......
// 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';
// 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() {}
// 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;
// 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 };
// 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 };
// 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;
}
// 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;
// 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 };
// 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';
}
// 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;
// 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;
// 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;
// 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;
}
// 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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment