tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

after-same-line-static-async-gen-literal-names-asi.js (2255B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/class-elements/literal-names-asi.case
      4 // - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
      5 /*---
      6 description: Literal property names with ASI (field definitions after a static async generator in the same line)
      7 esid: prod-FieldDefinition
      8 features: [class-fields-public, class, async-iteration]
      9 flags: [generated, async]
     10 includes: [propertyHelper.js]
     11 info: |
     12    ClassElement:
     13      ...
     14      FieldDefinition ;
     15 
     16    FieldDefinition:
     17      ClassElementName Initializer_opt
     18 
     19    ClassElementName:
     20      PropertyName
     21 
     22 ---*/
     23 
     24 
     25 class C {
     26  static async *m() { return 42; } a
     27  b = 42;;
     28  
     29 }
     30 
     31 var c = new C();
     32 
     33 assert(
     34  !Object.prototype.hasOwnProperty.call(c, "m"),
     35  "m doesn't appear as an own property on the C instance"
     36 );
     37 assert(
     38  !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
     39  "m doesn't appear as an own property on the C prototype"
     40 );
     41 
     42 verifyProperty(C, "m", {
     43  enumerable: false,
     44  configurable: true,
     45  writable: true,
     46 }, {restore: true});
     47 
     48 C.m().next().then(function(v) {
     49  assert.sameValue(v.value, 42);
     50  assert.sameValue(v.done, true);
     51 
     52  function assertions() {
     53    // Cover $DONE handler for async cases.
     54    function $DONE(error) {
     55      if (error) {
     56        throw new Test262Error('Test262:AsyncTestFailure')
     57      }
     58    }
     59    assert(
     60      !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
     61      "a doesn't appear as an own property on C prototype"
     62    );
     63    assert(
     64      !Object.prototype.hasOwnProperty.call(C, "a"),
     65      "a doesn't appear as an own property on C constructor"
     66    );
     67 
     68    verifyProperty(c, "a", {
     69      value: undefined,
     70      enumerable: true,
     71      writable: true,
     72      configurable: true
     73    });
     74 
     75    assert(
     76      !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     77      "b doesn't appear as an own property on C prototype"
     78    );
     79    assert(
     80      !Object.prototype.hasOwnProperty.call(C, "b"),
     81      "b doesn't appear as an own property on C constructor"
     82    );
     83 
     84    verifyProperty(c, "b", {
     85      value: 42,
     86      enumerable: true,
     87      writable: true,
     88      configurable: true
     89    });
     90  }
     91 
     92  return Promise.resolve(assertions());
     93 }).then($DONE, $DONE);