From d887db88ee58d633e355e1e2b94d7256742ce536 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Bargull?= <andre.bargull@gmail.com>
Date: Tue, 2 May 2017 12:09:30 -0700
Subject: [PATCH] Add tests escaped/unescaped yield/await labels

---
 .../labeled/function-declaration.js           |  1 +
 .../labeled/value-await-module-escaped.js     | 19 ++++++++++++++++++
 .../statements/labeled/value-await-module.js  | 18 +++++++++++++++++
 .../labeled/value-await-non-module-escaped.js | 15 ++++++++++++++
 .../labeled/value-await-non-module.js         | 14 +++++++++++++
 .../labeled/value-yield-non-strict-escaped.js | 11 ++++++++++
 .../labeled/value-yield-strict-escaped.js     | 20 +++++++++++++++++++
 7 files changed, 98 insertions(+)
 create mode 100644 test/language/statements/labeled/value-await-module-escaped.js
 create mode 100644 test/language/statements/labeled/value-await-module.js
 create mode 100644 test/language/statements/labeled/value-await-non-module-escaped.js
 create mode 100644 test/language/statements/labeled/value-await-non-module.js
 create mode 100644 test/language/statements/labeled/value-yield-non-strict-escaped.js
 create mode 100644 test/language/statements/labeled/value-yield-strict-escaped.js

diff --git a/test/annexB/language/statements/labeled/function-declaration.js b/test/annexB/language/statements/labeled/function-declaration.js
index 86eb59042b..d93df289b9 100644
--- a/test/annexB/language/statements/labeled/function-declaration.js
+++ b/test/annexB/language/statements/labeled/function-declaration.js
@@ -9,3 +9,4 @@ flags: [noStrict]
 ---*/
 label: function g() {}
 
+label1: label2: function f() {}
diff --git a/test/language/statements/labeled/value-await-module-escaped.js b/test/language/statements/labeled/value-await-module-escaped.js
new file mode 100644
index 0000000000..7997a19faf
--- /dev/null
+++ b/test/language/statements/labeled/value-await-module-escaped.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+  `await` is a reserved identifier in module code and may not be used as a label.
+info: |
+  Identifier : IdentifierName but not ReservedWord
+
+  It is a Syntax Error if the goal symbol of the syntactic grammar is Module and
+  the StringValue of IdentifierName is "await".
+negative:
+  phase: early
+  type: SyntaxError
+flags: [module]
+---*/
+
+aw\u0061it: 1;
diff --git a/test/language/statements/labeled/value-await-module.js b/test/language/statements/labeled/value-await-module.js
new file mode 100644
index 0000000000..4744a2fd62
--- /dev/null
+++ b/test/language/statements/labeled/value-await-module.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+  `await` is a reserved identifier in module code and may not be used as a label.
+info: |
+  LabelIdentifier : await
+
+  It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
+negative:
+  phase: early
+  type: SyntaxError
+flags: [module]
+---*/
+
+await: 1;
diff --git a/test/language/statements/labeled/value-await-non-module-escaped.js b/test/language/statements/labeled/value-await-non-module-escaped.js
new file mode 100644
index 0000000000..71cb1b51b7
--- /dev/null
+++ b/test/language/statements/labeled/value-await-non-module-escaped.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+  `await` is not a reserved identifier in non-module code and may be used as a label.
+info: |
+  Identifier : IdentifierName but not ReservedWord
+
+  It is a Syntax Error if the goal symbol of the syntactic grammar is Module and
+  the StringValue of IdentifierName is "await".
+---*/
+
+aw\u0061it: 1;
diff --git a/test/language/statements/labeled/value-await-non-module.js b/test/language/statements/labeled/value-await-non-module.js
new file mode 100644
index 0000000000..295f92db4c
--- /dev/null
+++ b/test/language/statements/labeled/value-await-non-module.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+  `await` is not a reserved identifier in non-module code and may be used as a label.
+info: |
+  LabelIdentifier : await
+
+  It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
+---*/
+
+await: 1;
diff --git a/test/language/statements/labeled/value-yield-non-strict-escaped.js b/test/language/statements/labeled/value-yield-non-strict-escaped.js
new file mode 100644
index 0000000000..a8a328fb41
--- /dev/null
+++ b/test/language/statements/labeled/value-yield-non-strict-escaped.js
@@ -0,0 +1,11 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+  `yield` is not a reserved identifier in non-strict mode code and may be used as a label.
+flags: [noStrict]
+---*/
+
+yi\u0065ld: 1;
diff --git a/test/language/statements/labeled/value-yield-strict-escaped.js b/test/language/statements/labeled/value-yield-strict-escaped.js
new file mode 100644
index 0000000000..d77bea83b2
--- /dev/null
+++ b/test/language/statements/labeled/value-yield-strict-escaped.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+  `yield` is a reserved identifier in strict mode code and may not be used as a label.
+info: |
+  Identifier : IdentifierName but not ReservedWord
+
+  It is a Syntax Error if this phrase is contained in strict mode code and the
+  StringValue of IdentifierName is: "implements", "interface", "let", "package",
+  "private", "protected", "public", "static", or "yield".
+negative:
+  phase: early
+  type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+yi\u0065ld: 1;
-- 
GitLab