ソースを参照

Update generator and module/export/import related tests (#978)

Marko Lahma 3 年 前
コミット
c98cf5c6f6
100 ファイル変更1050 行追加61 行削除
  1. 23 0
      Jint.Tests.Test262/BuiltIns/GeneratorTests.cs
  2. 31 0
      Jint.Tests.Test262/Language/ModuleTests.cs
  3. 7 1
      Jint.Tests.Test262/Test262Test.cs
  4. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/extensibility.js
  5. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/instance-length.js
  6. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/instance-prototype.js
  7. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/instance-yield-expr-in-param.js
  8. 1 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js
  9. 24 0
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/is-a-constructor.js
  10. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/length.js
  11. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/name.js
  12. 50 0
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/proto-from-ctor-realm-prototype.js
  13. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/proto-from-ctor-realm.js
  14. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/prototype/constructor.js
  15. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/prototype/extensibility.js
  16. 28 0
      Jint.Tests.Test262/test/built-ins/GeneratorFunction/prototype/not-callable.js
  17. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/from-state-executing.js
  18. 33 0
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/not-a-constructor.js
  19. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js
  20. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/this-val-not-object.js
  21. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/from-state-executing.js
  22. 33 0
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/not-a-constructor.js
  23. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js
  24. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/this-val-not-object.js
  25. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/from-state-executing.js
  26. 33 0
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/not-a-constructor.js
  27. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/this-val-not-generator.js
  28. 0 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/this-val-not-object.js
  29. 1 1
      Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-inner-try.js
  30. 2 2
      Jint.Tests.Test262/test/language/export/escaped-as-export-specifier.js
  31. 2 2
      Jint.Tests.Test262/test/language/export/escaped-default.js
  32. 2 2
      Jint.Tests.Test262/test/language/export/escaped-from.js
  33. 1 1
      Jint.Tests.Test262/test/language/import/dup-bound-names.js
  34. 2 2
      Jint.Tests.Test262/test/language/import/escaped-as-import-specifier.js
  35. 2 2
      Jint.Tests.Test262/test/language/import/escaped-as-namespace-import.js
  36. 2 2
      Jint.Tests.Test262/test/language/import/escaped-from.js
  37. 20 0
      Jint.Tests.Test262/test/language/import/json-extensibility-array.js
  38. 20 0
      Jint.Tests.Test262/test/language/import/json-extensibility-object.js
  39. 6 0
      Jint.Tests.Test262/test/language/import/json-idempotency-indirect_FIXTURE.js
  40. 21 0
      Jint.Tests.Test262/test/language/import/json-idempotency.js
  41. 1 0
      Jint.Tests.Test262/test/language/import/json-idempotency_FIXTURE.json
  42. 23 0
      Jint.Tests.Test262/test/language/import/json-invalid.js
  43. 3 0
      Jint.Tests.Test262/test/language/import/json-invalid_FIXTURE.json
  44. 20 0
      Jint.Tests.Test262/test/language/import/json-named-bindings.js
  45. 3 0
      Jint.Tests.Test262/test/language/import/json-named-bindings_FIXTURE.json
  46. 47 0
      Jint.Tests.Test262/test/language/import/json-value-array.js
  47. 10 0
      Jint.Tests.Test262/test/language/import/json-value-array_FIXTURE.json
  48. 20 0
      Jint.Tests.Test262/test/language/import/json-value-boolean.js
  49. 1 0
      Jint.Tests.Test262/test/language/import/json-value-boolean_FIXTURE.json
  50. 20 0
      Jint.Tests.Test262/test/language/import/json-value-null.js
  51. 1 0
      Jint.Tests.Test262/test/language/import/json-value-null_FIXTURE.json
  52. 20 0
      Jint.Tests.Test262/test/language/import/json-value-number.js
  53. 1 0
      Jint.Tests.Test262/test/language/import/json-value-number_FIXTURE.json
  54. 67 0
      Jint.Tests.Test262/test/language/import/json-value-object.js
  55. 10 0
      Jint.Tests.Test262/test/language/import/json-value-object_FIXTURE.json
  56. 20 0
      Jint.Tests.Test262/test/language/import/json-value-string.js
  57. 1 0
      Jint.Tests.Test262/test/language/import/json-value-string_FIXTURE.json
  58. 13 0
      Jint.Tests.Test262/test/language/import/json-via-namespace.js
  59. 1 0
      Jint.Tests.Test262/test/language/import/json-via-namespace_FIXTURE.json
  60. 1 1
      Jint.Tests.Test262/test/language/module-code/comment-multi-line-html-close.js
  61. 1 1
      Jint.Tests.Test262/test/language/module-code/comment-single-line-html-close.js
  62. 1 1
      Jint.Tests.Test262/test/language/module-code/comment-single-line-html-open.js
  63. 24 0
      Jint.Tests.Test262/test/language/module-code/early-dup-assert-key-export.js
  64. 25 0
      Jint.Tests.Test262/test/language/module-code/early-dup-assert-key-import-nobinding.js
  65. 25 0
      Jint.Tests.Test262/test/language/module-code/early-dup-assert-key-import-withbinding.js
  66. 2 2
      Jint.Tests.Test262/test/language/module-code/early-dup-export-as-star-as.js
  67. 1 1
      Jint.Tests.Test262/test/language/module-code/early-dup-export-decl.js
  68. 1 1
      Jint.Tests.Test262/test/language/module-code/early-dup-export-dflt-id.js
  69. 1 1
      Jint.Tests.Test262/test/language/module-code/early-dup-export-dflt.js
  70. 1 1
      Jint.Tests.Test262/test/language/module-code/early-dup-export-id-as.js
  71. 1 1
      Jint.Tests.Test262/test/language/module-code/early-dup-export-id.js
  72. 2 2
      Jint.Tests.Test262/test/language/module-code/early-dup-export-star-as-dflt.js
  73. 1 1
      Jint.Tests.Test262/test/language/module-code/early-dup-lables.js
  74. 2 2
      Jint.Tests.Test262/test/language/module-code/early-dup-lex.js
  75. 20 0
      Jint.Tests.Test262/test/language/module-code/early-dup-top-function-async-generator.js
  76. 20 0
      Jint.Tests.Test262/test/language/module-code/early-dup-top-function-async.js
  77. 20 0
      Jint.Tests.Test262/test/language/module-code/early-dup-top-function-generator.js
  78. 20 0
      Jint.Tests.Test262/test/language/module-code/early-dup-top-function.js
  79. 1 1
      Jint.Tests.Test262/test/language/module-code/early-export-global.js
  80. 25 0
      Jint.Tests.Test262/test/language/module-code/early-export-ill-formed-string.js
  81. 1 1
      Jint.Tests.Test262/test/language/module-code/early-export-unresolvable.js
  82. 1 1
      Jint.Tests.Test262/test/language/module-code/early-import-arguments.js
  83. 1 1
      Jint.Tests.Test262/test/language/module-code/early-import-as-arguments.js
  84. 1 1
      Jint.Tests.Test262/test/language/module-code/early-import-as-eval.js
  85. 1 1
      Jint.Tests.Test262/test/language/module-code/early-import-eval.js
  86. 1 1
      Jint.Tests.Test262/test/language/module-code/early-lex-and-var.js
  87. 1 1
      Jint.Tests.Test262/test/language/module-code/early-new-target.js
  88. 1 1
      Jint.Tests.Test262/test/language/module-code/early-strict-mode.js
  89. 1 1
      Jint.Tests.Test262/test/language/module-code/early-super.js
  90. 1 1
      Jint.Tests.Test262/test/language/module-code/early-undef-break.js
  91. 1 1
      Jint.Tests.Test262/test/language/module-code/early-undef-continue.js
  92. 70 0
      Jint.Tests.Test262/test/language/module-code/eval-gtbndng-indirect-faux-assertion.js
  93. 1 0
      Jint.Tests.Test262/test/language/module-code/eval-rqstd-once.js
  94. 23 0
      Jint.Tests.Test262/test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js
  95. 18 0
      Jint.Tests.Test262/test/language/module-code/export-default-asyncfunction-declaration-binding.js
  96. 23 0
      Jint.Tests.Test262/test/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js
  97. 18 0
      Jint.Tests.Test262/test/language/module-code/export-default-asyncgenerator-declaration-binding.js
  98. 24 0
      Jint.Tests.Test262/test/language/module-code/export-default-function-declaration-binding-exists.js
  99. 18 0
      Jint.Tests.Test262/test/language/module-code/export-default-function-declaration-binding.js
  100. 23 0
      Jint.Tests.Test262/test/language/module-code/export-default-generator-declaration-binding-exists.js

+ 23 - 0
Jint.Tests.Test262/BuiltIns/GeneratorTests.cs

@@ -0,0 +1,23 @@
+using Xunit;
+
+namespace Jint.Tests.Test262.BuiltIns
+{
+    public class GeneratorTests : Test262Test
+    {
+        [Theory(DisplayName = "built-ins\\GeneratorFunction", Skip = "TODO")]
+        [MemberData(nameof(SourceFiles), "built-ins\\GeneratorFunction", false)]
+        [MemberData(nameof(SourceFiles), "built-ins\\GeneratorFunction", true, Skip = "Skipped")]
+        protected void GeneratorFunction(SourceFile sourceFile)
+        {
+            RunTestInternal(sourceFile);
+        }
+
+        [Theory(DisplayName = "built-ins\\GeneratorPrototype")]
+        [MemberData(nameof(SourceFiles), "built-ins\\GeneratorPrototype", false)]
+        [MemberData(nameof(SourceFiles), "built-ins\\GeneratorPrototype", true, Skip = "Skipped")]
+        protected void GeneratorPrototype(SourceFile sourceFile)
+        {
+            RunTestInternal(sourceFile);
+        }
+    }
+}

+ 31 - 0
Jint.Tests.Test262/Language/ModuleTests.cs

@@ -0,0 +1,31 @@
+using Xunit;
+
+namespace Jint.Tests.Test262.Language
+{
+    public class ModuleTests : Test262Test
+    {
+        [Theory(DisplayName = "language\\module-code", Skip = "TODO")]
+        [MemberData(nameof(SourceFiles), "language\\module-code", false)]
+        [MemberData(nameof(SourceFiles), "language\\module-code", true, Skip = "Skipped")]
+        protected void ModuleCode(SourceFile sourceFile)
+        {
+            RunTestInternal(sourceFile);
+        }
+
+        [Theory(DisplayName = "language\\export")]
+        [MemberData(nameof(SourceFiles), "language\\export", false)]
+        [MemberData(nameof(SourceFiles), "language\\export", true, Skip = "Skipped")]
+        protected void Export(SourceFile sourceFile)
+        {
+            RunTestInternal(sourceFile);
+        }
+
+        [Theory(DisplayName = "language\\import", Skip = "TODO")]
+        [MemberData(nameof(SourceFiles), "language\\import", false)]
+        [MemberData(nameof(SourceFiles), "language\\import", true, Skip = "Skipped")]
+        protected void Import(SourceFile sourceFile)
+        {
+            RunTestInternal(sourceFile);
+        }
+    }
+}

+ 7 - 1
Jint.Tests.Test262/Test262Test.cs

@@ -142,9 +142,15 @@ namespace Jint.Tests.Test262
             var includes = Regex.Match(code, @"includes: \[(.+?)\]");
             if (includes.Success)
             {
-                var files = includes.Groups[1].Captures[0].Value.Split(',');
+                var files = includes.Groups[1].Captures[0].Value.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
                 foreach (var file in files)
                 {
+                    if (file == "hidden-constructors.js")
+                    {
+                        // suite refers to non-existent file
+                        continue;
+                    }
+
                     engine.Execute(Sources[file.Trim()]);
                 }
             }

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/extensibility.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-properties-of-the-generatorfunction-constructor
-es6id: 25.2.2
 description: Object extensibility
 info: |
   The value of the [[Extensible]] internal slot of the GeneratorFunction

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/instance-length.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorfunction
-es6id: 25.2.1.1
 description: Definition of instance `length` property
 info: |
     [...]

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/instance-prototype.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorfunction
-es6id: 25.2.1.1
 description: Definition of instance `prototype` property
 info: |
     [...]

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/instance-yield-expr-in-param.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorfunction
-es6id: 25.2.1.1
 description: Definition of instance `length` property
 info: |
     [...]

+ 1 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js

@@ -6,7 +6,7 @@ description: >
     When invoked via the function invocation pattern with multiple arguments,
     the GeneratorFunction intrinsic creates a valid generator whose body is the
     last argument evaluated as source code and whose formal parameters are
-    defined by the preceeding arguments.
+    defined by the preceding arguments.
 features: [generators]
 ---*/
 

+ 24 - 0
Jint.Tests.Test262/test/built-ins/GeneratorFunction/is-a-constructor.js

@@ -0,0 +1,24 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+  The GeneratorFunction constructor implements [[Construct]]
+info: |
+  IsConstructor ( argument )
+
+  The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
+  It determines if argument is a function object with a [[Construct]] internal method.
+  It performs the following steps when called:
+
+  If Type(argument) is not Object, return false.
+  If argument has a [[Construct]] internal method, return true.
+  Return false.
+includes: [isConstructor.js, hidden-constructors.js]
+features: [Reflect.construct]
+---*/
+
+assert.sameValue(isConstructor(GeneratorFunction), true, 'isConstructor(GeneratorFunction) must return true');
+new GeneratorFunction();
+  

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/length.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorfunction.length
-es6id: 25.2.2.1
 description: >
   This is a data property with a value of 1. This property has the attributes {
   [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/name.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-properties-of-the-generatorfunction-constructor
-es6id: 25.2.2
 description: Function "name" property
 info: |
   The value of the name property of the GeneratorFunction is

+ 50 - 0
Jint.Tests.Test262/test/built-ins/GeneratorFunction/proto-from-ctor-realm-prototype.js

@@ -0,0 +1,50 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-createdynamicfunction
+description: >
+  While default [[Prototype]] value derives from realm of the newTarget,
+  "prototype" object inherits from %Object.prototype% of constructor's realm.
+info: |
+  GeneratorFunction ( p1, p2, … , pn, body )
+
+  [...]
+  3. Return ? CreateDynamicFunction(C, NewTarget, generator, args).
+
+  CreateDynamicFunction ( constructor, newTarget, kind, args )
+
+  [...]
+  18. Let proto be ? GetPrototypeFromConstructor(newTarget, fallbackProto).
+  19. Let realmF be the current Realm Record.
+  20. Let scope be realmF.[[GlobalEnv]].
+  21. Let F be ! OrdinaryFunctionCreate(proto, parameters, body, non-lexical-this, scope).
+  [...]
+  23. If kind is generator, then
+    a. Let prototype be OrdinaryObjectCreate(%Generator.prototype%).
+    b. Perform DefinePropertyOrThrow(F, "prototype", PropertyDescriptor { [[Value]]: prototype,
+    [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }).
+  [...]
+  30. Return F.
+features: [generators, cross-realm, Reflect]
+---*/
+
+var realmA = $262.createRealm().global;
+realmA.calls = 0;
+var aGeneratorFunction = realmA.eval("(function* () {})").constructor;
+var aGeneratorPrototype = Object.getPrototypeOf(
+  realmA.eval("(function* () {})").prototype
+);
+
+var realmB = $262.createRealm().global;
+var bGeneratorFunction = realmB.eval("(function* () {})").constructor;
+var newTarget = new realmB.Function();
+newTarget.prototype = null;
+
+var fn = Reflect.construct(aGeneratorFunction, ["calls += 1;"], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), bGeneratorFunction.prototype);
+assert.sameValue(Object.getPrototypeOf(fn.prototype), aGeneratorPrototype);
+
+var gen = fn();
+assert(gen instanceof realmA.Object);
+gen.next();
+assert.sameValue(realmA.calls, 1);

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/proto-from-ctor-realm.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorfunction
-es6id: 25.2.1.1
 description: Default [[Prototype]] value derived from realm of the newTarget
 info: |
     [...]

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/prototype/constructor.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorfunction.prototype.constructor
-es6id: 25.2.3.1
 description: >
   `constructor` property of the GeneratorFunction.prototype object
 info: |

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorFunction/prototype/extensibility.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-properties-of-the-generatorfunction-prototype-object
-es6id: 25.2.3
 description: Object extensibility
 info: |
   The initial value of the [[Extensible]] internal slot of the

+ 28 - 0
Jint.Tests.Test262/test/built-ins/GeneratorFunction/prototype/not-callable.js

@@ -0,0 +1,28 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-the-generatorfunction-prototype-object
+description: >
+  %GeneratorFunction.prototype% is an ordinary non-callable object.
+info: |
+  Properties of the GeneratorFunction Prototype Object
+
+  The GeneratorFunction prototype object:
+
+  [...]
+  * is an ordinary object.
+  * is not a function object and does not have an [[ECMAScriptCode]] internal slot
+    or any other of the internal slots listed in Table 28 or Table 74.
+features: [generators]
+---*/
+
+var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {});
+
+assert.sameValue(typeof GeneratorFunctionPrototype, "object");
+assert.throws(TypeError, function() {
+  GeneratorFunctionPrototype();
+});
+
+assert(!GeneratorFunctionPrototype.hasOwnProperty("length"), "length");
+assert(!GeneratorFunctionPrototype.hasOwnProperty("name"), "name");

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/from-state-executing.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorvalidate
-es6id: 25.3.3.2
 description: >
     A TypeError should be thrown if the generator is resumed while in the
     "executing" state and the generator should be marked as "completed"

+ 33 - 0
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/not-a-constructor.js

@@ -0,0 +1,33 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+  Object.getPrototypeOf((function* g() {}).prototype).next does not implement [[Construct]], is not new-able
+info: |
+  ECMAScript Function Objects
+
+  Built-in function objects that are not identified as constructors do not
+  implement the [[Construct]] internal method unless otherwise specified in
+  the description of a particular function.
+
+  sec-evaluatenew
+
+  ...
+  7. If IsConstructor(constructor) is false, throw a TypeError exception.
+  ...
+includes: [isConstructor.js]
+features: [Reflect.construct, generators, arrow-function]
+---*/
+
+assert.sameValue(
+  isConstructor(Object.getPrototypeOf((function* g() {}).prototype).next),
+  false,
+  'isConstructor(Object.getPrototypeOf((function* g() {}).prototype).next) must return false'
+);
+
+assert.throws(TypeError, () => {
+  function* g() {} let iterator = g(); new iterator.next();
+}, '`function* g() {} let iterator = g(); new iterator.next()` throws TypeError');
+

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generator.prototype.next
-es6id: 25.3.1.2
 description: >
     A TypeError should be thrown from GeneratorValidate (25.3.3.2) if the
     context of `next` does not define the [[GeneratorState]] internal slot.

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/next/this-val-not-object.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generator.prototype.next
-es6id: 25.3.1.2
 description: >
   A TypeError should be thrown from GeneratorValidate (25.3.3.2) if the "this"
   value of `next` is not an object.

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/from-state-executing.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorvalidate
-es6id: 25.3.3.2
 description: >
   A TypeError should be thrown if the generator is in the "executing" state,
   and the generator should be marked as "completed"

+ 33 - 0
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/not-a-constructor.js

@@ -0,0 +1,33 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+  Object.getPrototypeOf((function* g() {}).prototype).return does not implement [[Construct]], is not new-able
+info: |
+  ECMAScript Function Objects
+
+  Built-in function objects that are not identified as constructors do not
+  implement the [[Construct]] internal method unless otherwise specified in
+  the description of a particular function.
+
+  sec-evaluatenew
+
+  ...
+  7. If IsConstructor(constructor) is false, throw a TypeError exception.
+  ...
+includes: [isConstructor.js]
+features: [Reflect.construct, generators, arrow-function]
+---*/
+
+assert.sameValue(
+  isConstructor(Object.getPrototypeOf((function* g() {}).prototype).return),
+  false,
+  'isConstructor(Object.getPrototypeOf((function* g() {}).prototype).return) must return false'
+);
+
+assert.throws(TypeError, () => {
+  function* g() {} let iterator = g(); new iterator.return();
+}, '`function* g() {} let iterator = g(); new iterator.return()` throws TypeError');
+

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generator.prototype.return
-es6id: 25.3.1.3
 description: >
     A TypeError should be thrown from GeneratorValidate (25.3.3.2) if the
     context of `return` does not define the [[GeneratorState]] internal slot.

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/return/this-val-not-object.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generator.prototype.return
-es6id: 25.3.1.3
 description: >
   A TypeError should be thrown from GeneratorValidate (25.3.3.2) if the "this"
   value of `return` is not an object.

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/from-state-executing.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generatorvalidate
-es6id: 25.3.3.2
 description: >
   A TypeError should be thrown if the generator is in the "executing" state,
   and the generator should be marked as "completed"

+ 33 - 0
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/not-a-constructor.js

@@ -0,0 +1,33 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+  Object.getPrototypeOf((function* g() {}).prototype).throw does not implement [[Construct]], is not new-able
+info: |
+  ECMAScript Function Objects
+
+  Built-in function objects that are not identified as constructors do not
+  implement the [[Construct]] internal method unless otherwise specified in
+  the description of a particular function.
+
+  sec-evaluatenew
+
+  ...
+  7. If IsConstructor(constructor) is false, throw a TypeError exception.
+  ...
+includes: [isConstructor.js]
+features: [Reflect.construct, generators, arrow-function]
+---*/
+
+assert.sameValue(
+  isConstructor(Object.getPrototypeOf((function* g() {}).prototype).throw),
+  false,
+  'isConstructor(Object.getPrototypeOf((function* g() {}).prototype).throw) must return false'
+);
+
+assert.throws(TypeError, () => {
+  function* g() {} let expected = new Test262Error(); let iterator = g();try {new iterator.throw(expected);} catch (e) {if (e !== expected) {throw e;}}
+}, '`function* g() {} let expected = new Test262Error(); let iterator = g();try {new iterator.throw(expected);} catch (e) {if (e !== expected) {throw e;}}` throws TypeError');
+

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/this-val-not-generator.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generator.prototype.throw
-es6id: 25.3.1.4
 description: >
     A TypeError should be thrown from GeneratorValidate (25.3.3.2) if the
     context of `throw` does not define the [[GeneratorState]] internal slot.

+ 0 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/this-val-not-object.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-generator.prototype.throw
-es6id: 25.3.1.4
 description: >
   A TypeError should be thrown from GeneratorValidate (25.3.3.2) if the "this"
   value of `throw` is not an object.

+ 1 - 1
Jint.Tests.Test262/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-inner-try.js

@@ -54,7 +54,7 @@ assert.sameValue(result.done, false, 'Fourth result `done` flag');
 
 result = iter.next();
 assert.sameValue(result.value, 4, 'Fifth result `value`');
-assert.sameValue(result.done, false, 'Firth result `done` flag');
+assert.sameValue(result.done, false, 'Fifth result `done` flag');
 
 result = iter.next();
 assert.sameValue(result.value, 5, 'Sixth result `value`');

+ 2 - 2
Jint.Tests.Test262/test/language/export/escaped-as-export-specifier.js

@@ -6,7 +6,7 @@ esid: sec-grammar-notation
 description: >
   The `as` contextual keyword must not contain Unicode escape sequences.
 info: |
-  Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+  Terminal symbols are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
   are to appear in a script exactly as written. All terminal symbol code points
@@ -19,7 +19,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export var a = 0;
 export {a \u0061s b} from "./escaped-as-export-specifier.js";

+ 2 - 2
Jint.Tests.Test262/test/language/export/escaped-default.js

@@ -6,7 +6,7 @@ esid: sec-grammar-notation
 description: >
   The `default` keyword must not contain Unicode escape sequences.
 info: |
-  Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+  Terminal symbols are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
   are to appear in a script exactly as written. All terminal symbol code points
@@ -19,6 +19,6 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export d\u0065fault 0;

+ 2 - 2
Jint.Tests.Test262/test/language/export/escaped-from.js

@@ -6,7 +6,7 @@ esid: sec-grammar-notation
 description: >
   The `from` contextual keyword must not contain Unicode escape sequences.
 info: |
-  Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+  Terminal symbols are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
   are to appear in a script exactly as written. All terminal symbol code points
@@ -19,6 +19,6 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export {} \u0066rom "./escaped-from.js";

+ 1 - 1
Jint.Tests.Test262/test/language/import/dup-bound-names.js

@@ -11,6 +11,6 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 import { x, y as x } from 'z';

+ 2 - 2
Jint.Tests.Test262/test/language/import/escaped-as-import-specifier.js

@@ -6,7 +6,7 @@ esid: sec-grammar-notation
 description: >
   The `as` contextual keyword must not contain Unicode escape sequences.
 info: |
-  Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+  Terminal symbols are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
   are to appear in a script exactly as written. All terminal symbol code points
@@ -19,7 +19,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export var a = 0;
 

+ 2 - 2
Jint.Tests.Test262/test/language/import/escaped-as-namespace-import.js

@@ -6,7 +6,7 @@ esid: sec-grammar-notation
 description: >
   The `as` contextual keyword must not contain Unicode escape sequences.
 info: |
-  Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+  Terminal symbols are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
   are to appear in a script exactly as written. All terminal symbol code points
@@ -19,6 +19,6 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 import* \u0061s self from "./escaped-as-namespace-import.js";

+ 2 - 2
Jint.Tests.Test262/test/language/import/escaped-from.js

@@ -6,7 +6,7 @@ esid: sec-grammar-notation
 description: >
   The `from` contextual keyword must not contain Unicode escape sequences.
 info: |
-  Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+  Terminal symbols are shown
   in fixed width font, both in the productions of the grammars and throughout this
   specification whenever the text directly refers to such a terminal symbol. These
   are to appear in a script exactly as written. All terminal symbol code points
@@ -19,6 +19,6 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 import {} \u0066rom "./escaped-from.js";

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-extensibility-array.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Creates extensible arrays
+flags: [module]
+includes: [propertyHelper.js]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-array_FIXTURE.json' assert { type: 'json' };
+
+value.test262property = 'test262 value';
+
+verifyProperty(value, 'test262property', {
+  value: 'test262 value',
+  writable: true,
+  enumerable: true,
+  configurable: true
+});

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-extensibility-object.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Creates extensible objects
+flags: [module]
+includes: [propertyHelper.js]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-object_FIXTURE.json' assert { type: 'json' };
+
+value.test262property = 'test262 value';
+
+verifyProperty(value, 'test262property', {
+  value: 'test262 value',
+  writable: true,
+  enumerable: true,
+  configurable: true
+});

+ 6 - 0
Jint.Tests.Test262/test/language/import/json-idempotency-indirect_FIXTURE.js

@@ -0,0 +1,6 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+import value from './json-idempotency_FIXTURE.json' assert { type: 'json' };
+
+globalThis.viaSecondModule = value;

+ 21 - 0
Jint.Tests.Test262/test/language/import/json-idempotency.js

@@ -0,0 +1,21 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: The same object representation is returned to all import sites
+flags: [module, async]
+features: [import-assertions, json-modules, globalThis, dynamic-import]
+---*/
+
+import viaStaticImport1 from './json-idempotency_FIXTURE.json' assert { type: 'json' };
+import {default as viaStaticImport2} from './json-idempotency_FIXTURE.json' assert { type: 'json' };
+import './json-idempotency-indirect_FIXTURE.js';
+
+assert.sameValue(viaStaticImport1, viaStaticImport2);
+assert.sameValue(globalThis.viaSecondModule, viaStaticImport1);
+
+import('./json-idempotency_FIXTURE.json', { assert: { type: 'json' } })
+  .then(function(viaDynamicImport) {
+    assert.sameValue(viaDynamicImport.default, viaStaticImport1);
+  })
+  .then($DONE, $DONE);

+ 1 - 0
Jint.Tests.Test262/test/language/import/json-idempotency_FIXTURE.json

@@ -0,0 +1 @@
+{}

+ 23 - 0
Jint.Tests.Test262/test/language/import/json-invalid.js

@@ -0,0 +1,23 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Does not define
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-assertions, json-modules]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import value from './json-invalid_FIXTURE.json' assert { type: 'json' };

+ 3 - 0
Jint.Tests.Test262/test/language/import/json-invalid_FIXTURE.json

@@ -0,0 +1,3 @@
+{
+  notJson: 0
+}

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-named-bindings.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Does not define named bindings
+info: |
+  In the early design of JSON modules, contributors considered allowing the
+  properties of object values in JSON modules to be imported directly by name.
+  This was ultimately rejected, so attempting to import in this way should
+  produce a SyntaxError.
+flags: [module]
+features: [import-assertions, json-modules]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import {name} from './json-named-bindings_FIXTURE.json' assert { type: 'json' };

+ 3 - 0
Jint.Tests.Test262/test/language/import/json-named-bindings_FIXTURE.json

@@ -0,0 +1,3 @@
+{
+  "name": 0
+}

+ 47 - 0
Jint.Tests.Test262/test/language/import/json-value-array.js

@@ -0,0 +1,47 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of an array
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+
+  To more fully verify parsing correctness, the source text of the imported
+  module record includes non-printable characters (specifically, all four forms
+  of JSON's so-called "whitespace" token) both before and after the "value."
+flags: [module]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-array_FIXTURE.json' assert { type: 'json' };
+
+assert(Array.isArray(value), 'the exported value is an array');
+assert.sameValue(
+  Object.getPrototypeOf(value),
+  Array.prototype,
+  'the exported value is not a subclass of Array'
+);
+assert.sameValue(Object.getOwnPropertyNames(value).length, 7);
+assert.sameValue(value.length, 6);
+
+assert.sameValue(value[0], -1.2345);
+assert.sameValue(value[1], true);
+assert.sameValue(value[2], 'a string value');
+assert.sameValue(value[3], null);
+
+assert.sameValue(Object.getPrototypeOf(value[4]), Object.prototype);
+assert.sameValue(Object.getOwnPropertyNames(value[4]).length, 0);
+
+assert(Array.isArray(value[5]), 'the fifth element is an array');
+assert.sameValue(
+  Object.getPrototypeOf(value[5]),
+  Array.prototype,
+  'the fifth element is not a subclass of Array'
+);
+assert.sameValue(Object.getOwnPropertyNames(value[5]).length, 1);

+ 10 - 0
Jint.Tests.Test262/test/language/import/json-value-array_FIXTURE.json

@@ -0,0 +1,10 @@
+ 
+
	[
+  -1234.500e-003,
+  true,
+  "a string value",
+  null,
+  {},
+  []
+] 
+
	

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-value-boolean.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of a boolean
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-boolean_FIXTURE.json' assert { type: 'json' };
+
+assert.sameValue(value, true);

+ 1 - 0
Jint.Tests.Test262/test/language/import/json-value-boolean_FIXTURE.json

@@ -0,0 +1 @@
+true

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-value-null.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of null
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-null_FIXTURE.json' assert { type: 'json' };
+
+assert.sameValue(value, null);

+ 1 - 0
Jint.Tests.Test262/test/language/import/json-value-null_FIXTURE.json

@@ -0,0 +1 @@
+null

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-value-number.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of a number
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-number_FIXTURE.json' assert { type: 'json' };
+
+assert.sameValue(value, -1.2345);

+ 1 - 0
Jint.Tests.Test262/test/language/import/json-value-number_FIXTURE.json

@@ -0,0 +1 @@
+-1234.500e-003

+ 67 - 0
Jint.Tests.Test262/test/language/import/json-value-object.js

@@ -0,0 +1,67 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of an ordinary object
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+
+  To more fully verify parsing correctness, the source text of the imported
+  module record includes non-printable characters (specifically, all four forms
+  of JSON's so-called "whitespace" token) both before and after the "value."
+flags: [module]
+includes: [propertyHelper.js]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-object_FIXTURE.json' assert { type: 'json' };
+
+assert.sameValue(Object.getPrototypeOf(value), Object.prototype);
+assert.sameValue(Object.getOwnPropertyNames(value).length, 6);
+
+verifyProperty(value, 'number', {
+  value: -1.2345,
+  writable: true,
+  enumerable: true,
+  configurable: true
+});
+
+verifyProperty(value, 'boolean', {
+  value: true,
+  writable: true,
+  enumerable: true,
+  configurable: true
+});
+
+verifyProperty(value, 'string', {
+  value: 'a string value',
+  writable: true,
+  enumerable: true,
+  configurable: true
+});
+
+verifyProperty(value, 'null', {
+  value: null,
+  writable: true,
+  enumerable: true,
+  configurable: true
+});
+
+assert.sameValue(Object.getPrototypeOf(value.object), Object.prototype);
+assert.sameValue(Object.getOwnPropertyNames(value.object).length, 0);
+
+assert(
+  Array.isArray(value.array), 'the value of the "array" property is an array'
+);
+assert.sameValue(
+  Object.getPrototypeOf(value.array),
+  Array.prototype,
+  'the value of the "array" property is not a subclass of Array'
+);
+assert.sameValue(Object.getOwnPropertyNames(value.array).length, 1);

+ 10 - 0
Jint.Tests.Test262/test/language/import/json-value-object_FIXTURE.json

@@ -0,0 +1,10 @@
+ 
+
	{
+  "number": -1234.500e-003,
+  "boolean": true,
+  "string": "a string value",
+  "null": null,
+  "object": {},
+  "array": []
+} 
+
	

+ 20 - 0
Jint.Tests.Test262/test/language/import/json-value-string.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of a string
+info: |
+  # 1.4 ParseJSONModule ( source )
+
+  The abstract operation ParseJSONModule takes a single argument source which
+  is a String representing the contents of a module.
+
+  1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+  2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-assertions, json-modules]
+---*/
+
+import value from './json-value-string_FIXTURE.json' assert { type: 'json' };
+
+assert.sameValue(value, 'a string value');

+ 1 - 0
Jint.Tests.Test262/test/language/import/json-value-string_FIXTURE.json

@@ -0,0 +1 @@
+"a string value"

+ 13 - 0
Jint.Tests.Test262/test/language/import/json-via-namespace.js

@@ -0,0 +1,13 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: May be imported via a module namespace object
+flags: [module]
+features: [import-assertions, json-modules]
+---*/
+
+import * as ns from './json-via-namespace_FIXTURE.json' assert { type: 'json' };
+
+assert.sameValue(Object.getOwnPropertyNames(ns).length, 1);
+assert.sameValue(ns.default, 262);

+ 1 - 0
Jint.Tests.Test262/test/language/import/json-via-namespace_FIXTURE.json

@@ -0,0 +1 @@
+262

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/comment-multi-line-html-close.js

@@ -11,7 +11,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 /*
 */-->

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/comment-single-line-html-close.js

@@ -11,6 +11,6 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 -->

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/comment-single-line-html-open.js

@@ -11,6 +11,6 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 <!--

+ 24 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-assert-key-export.js

@@ -0,0 +1,24 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AssertClause may not have duplicate keys (export declaration)
+esid: sec-modules
+info: |
+  AssertClause:assert{AssertEntries,opt}
+
+  - It is a Syntax Error if AssertClauseToAssertions of AssertClause has two
+    entries a and b such that a.[[Key]] is b.[[Key]].
+features: [import-assertions]
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export * from './import-assertion-3_FIXTURE.js' assert {
+  test262_a: '',
+  test262_b: '',
+  'test262_\u0061': ''
+};

+ 25 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-assert-key-import-nobinding.js

@@ -0,0 +1,25 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  AssertClause may not have duplicate keys (import declaration without binding)
+esid: sec-modules
+info: |
+  AssertClause:assert{AssertEntries,opt}
+
+  - It is a Syntax Error if AssertClauseToAssertions of AssertClause has two
+    entries a and b such that a.[[Key]] is b.[[Key]].
+features: [import-assertions]
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import './import-assertion-2_FIXTURE.js' assert {
+  test262_a: '',
+  test262_b: '',
+  'test262_\u0061': ''
+};

+ 25 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-assert-key-import-withbinding.js

@@ -0,0 +1,25 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  AssertClause may not have duplicate keys (import declaration with binding)
+esid: sec-modules
+info: |
+  AssertClause:assert{AssertEntries,opt}
+
+  - It is a Syntax Error if AssertClauseToAssertions of AssertClause has two
+    entries a and b such that a.[[Key]] is b.[[Key]].
+features: [import-assertions]
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import x from './import-assertion-1_FIXTURE.js' assert {
+  test262_a: '',
+  test262_b: '',
+  'test262_\u0061': ''
+};

+ 2 - 2
Jint.Tests.Test262/test/language/module-code/early-dup-export-as-star-as.js

@@ -12,8 +12,8 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 var x;
 export { x as z };
-export * as z from "early-dup-export-as-star-as.js";
+export * as z from './early-dup-export-as-star-as.js';

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-dup-export-decl.js

@@ -12,7 +12,7 @@ negative:
 features: [generators]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export function f() {}
 export function *f() {}

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-dup-export-dflt-id.js

@@ -12,7 +12,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 var x, y;
 export default x;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-dup-export-dflt.js

@@ -11,7 +11,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export default var x = null;
 export default var x = null;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-dup-export-id-as.js

@@ -12,7 +12,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 var x, y;
 export { x as z };

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-dup-export-id.js

@@ -11,7 +11,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 var x;
 export { x };

+ 2 - 2
Jint.Tests.Test262/test/language/module-code/early-dup-export-star-as-dflt.js

@@ -12,8 +12,8 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 var x;
 export default x;
-export * as default from 'early-dup-export-start-as-dflt.js';
+export * as default from './early-dup-export-start-as-dflt.js';

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-dup-lables.js

@@ -11,7 +11,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 label: {
   label: 0;

+ 2 - 2
Jint.Tests.Test262/test/language/module-code/early-dup-lex.js

@@ -1,7 +1,7 @@
 // Copyright (C) 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
+esid: sec-module-semantics-static-semantics-early-errors
 description: >
     It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
     contains any duplicate entries.
@@ -12,7 +12,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 let x;
 const x;

+ 20 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-top-function-async-generator.js

@@ -0,0 +1,20 @@
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+    It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+    contains any duplicate entries.
+    At the top level of a Module, function declarations are treated like
+    lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+async function* x() {}

+ 20 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-top-function-async.js

@@ -0,0 +1,20 @@
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+    It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+    contains any duplicate entries.
+    At the top level of a Module, function declarations are treated like
+    lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+async function x() {}

+ 20 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-top-function-generator.js

@@ -0,0 +1,20 @@
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+    It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+    contains any duplicate entries.
+    At the top level of a Module, function declarations are treated like
+    lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+function* x() {}

+ 20 - 0
Jint.Tests.Test262/test/language/module-code/early-dup-top-function.js

@@ -0,0 +1,20 @@
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+    It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+    contains any duplicate entries.
+    At the top level of a Module, function declarations are treated like
+    lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+function x() {}

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-export-global.js

@@ -14,6 +14,6 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export { Number };

+ 25 - 0
Jint.Tests.Test262/test/language/module-code/early-export-ill-formed-string.js

@@ -0,0 +1,25 @@
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+    Ill formed unicode cannot be an exported name
+esid: sec-module-semantics
+info: |
+    ModuleExportName : StringLiteral
+
+    It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of StringLiteral is *false*.
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+features: [arbitrary-module-namespace-names]
+---*/
+
+$DONOTEVALUATE();
+
+// 🌙 is '\uD83C\uDF19'
+export {Moon as "\uD83C",} from "./early-export-ill-formed-string.js";
+export {"\uD83C"} from "./early-export-ill-formed-string.js";
+import {'\uD83C' as Usagi} from "./early-export-ill-formed-string.js";
+
+function Moon() {}

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-export-unresolvable.js

@@ -12,6 +12,6 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 export { unresolvable };

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-import-arguments.js

@@ -24,7 +24,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 // Create an appropriately-named ExportEntry in order to avoid false positives
 // (e.g. cases where the implementation does not generate the expected early

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-import-as-arguments.js

@@ -24,7 +24,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 // Create an appropriately-named ExportEntry in order to avoid false positives
 // (e.g. cases where the implementation does not generate the expected early

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-import-as-eval.js

@@ -24,7 +24,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 // Create an appropriately-named ExportEntry in order to avoid false positives
 // (e.g. cases where the implementation does not generate the expected early

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-import-eval.js

@@ -24,7 +24,7 @@ negative:
 flags: [module]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 // Create an appropriately-named ExportEntry in order to avoid false positives
 // (e.g. cases where the implementation does not generate the expected early

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-lex-and-var.js

@@ -12,7 +12,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 let x;
 var x;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-new-target.js

@@ -11,6 +11,6 @@ negative:
 features: [new.target]
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 new.target;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-strict-mode.js

@@ -10,6 +10,6 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 var public;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-super.js

@@ -10,6 +10,6 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 super;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-undef-break.js

@@ -11,7 +11,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 while (false) {
   break undef;

+ 1 - 1
Jint.Tests.Test262/test/language/module-code/early-undef-continue.js

@@ -11,7 +11,7 @@ negative:
   type: SyntaxError
 ---*/
 
-throw "Test262: This statement should not be evaluated.";
+$DONOTEVALUATE();
 
 while (false) {
   continue undef;

+ 70 - 0
Jint.Tests.Test262/test/language/module-code/eval-gtbndng-indirect-faux-assertion.js

@@ -0,0 +1,70 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  AssertClause in ImportDeclaration may not be preceded by a line terminator
+esid: sec-modules
+info: |
+  ImportDeclaration:
+    import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+  AssertClause:
+    assert {}
+    assert {AssertEntries ,opt}
+
+  AssertEntries:
+    AssertionKey : StringLiteral
+    AssertionKey : StringLiteral , AssertEntries
+
+  AssertionKey:
+    IdentifierName
+    StringLiteral
+
+  The restriction LineTerminator could be verified more simply with a negative
+  syntax test. This test is designed to parse successfully in order to verify
+  the restriction more precisely.
+features: [import-assertions, globalThis]
+flags: [module, raw]
+---*/
+
+var callCount = 0;
+
+// Define a property on the global "this" value so that the effect of the
+// expected IdentifierReference can be observed.
+Object.defineProperty(globalThis, 'assert', {
+  get: function() {
+    callCount += 1;
+  }
+});
+
+import x from './import-assertion-1_FIXTURE.js'
+assert
+{test262:''};
+
+if (x !== 262.1) {
+  throw 'module value incorrectly imported - first declaration';
+}
+
+if (callCount !== 1) {
+  throw 'IdentifierReference not recognized - first declaration';
+}
+
+import './import-assertion-2_FIXTURE.js'
+assert
+{test262:''};
+
+if (globalThis.test262 !== 262.2) {
+  throw 'module value incorrectly imported - second declaration';
+}
+
+if (callCount !== 2) {
+  throw 'IdentifierReference not recognized - second declaration';
+}
+
+export * from './import-assertion-3_FIXTURE.js'
+assert
+{test262:''};
+
+if (callCount !== 3) {
+  throw 'IdentifierReference not recognized - third declaration';
+}

+ 1 - 0
Jint.Tests.Test262/test/language/module-code/eval-rqstd-once.js

@@ -24,6 +24,7 @@ export {} from './eval-rqstd-once_FIXTURE.js';
 import dflt2, {} from './eval-rqstd-once_FIXTURE.js';
 export * from './eval-rqstd-once_FIXTURE.js';
 export * as ns2 from './eval-rqstd-once_FIXTURE.js';
+export * as class from './eval-rqstd-once_FIXTURE.js';
 import dflt3, * as ns3 from './eval-rqstd-once_FIXTURE.js';
 export default null;
 

+ 23 - 0
Jint.Tests.Test262/test/language/module-code/export-default-asyncfunction-declaration-binding-exists.js

@@ -0,0 +1,23 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : AsyncFunctionDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {};
+export default async function A() {}

+ 18 - 0
Jint.Tests.Test262/test/language/module-code/export-default-asyncfunction-declaration-binding.js

@@ -0,0 +1,18 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : AsyncFunctionDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default async function A() {}
+A.foo = '';

+ 23 - 0
Jint.Tests.Test262/test/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js

@@ -0,0 +1,23 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : AsyncGeneratorDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class AG {}
+export default async function * AG() {}

+ 18 - 0
Jint.Tests.Test262/test/language/module-code/export-default-asyncgenerator-declaration-binding.js

@@ -0,0 +1,18 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : AsyncGeneratorDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default async function * AG() {}
+AG.foo = '';

+ 24 - 0
Jint.Tests.Test262/test/language/module-code/export-default-function-declaration-binding-exists.js

@@ -0,0 +1,24 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : FunctionDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    FunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class F {}
+export default function F() {}
+

+ 18 - 0
Jint.Tests.Test262/test/language/module-code/export-default-function-declaration-binding.js

@@ -0,0 +1,18 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : FunctionDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    FunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default function F() {}
+F.foo = '';

+ 23 - 0
Jint.Tests.Test262/test/language/module-code/export-default-generator-declaration-binding-exists.js

@@ -0,0 +1,23 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  ExportDeclaration : HoistableDeclaration : GeneratorDeclaration
+  esid: prod-HoistableDeclaration
+info: |
+  ExportDeclaration :
+    HoistableDeclaration[Yield, Await, Default]:
+
+  HoistableDeclaration[Yield, Await, Default]:
+    GeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+  phase: parse
+  type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class G {}
+export default function * G() {}

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません