tor-browser

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

same-line-async-gen-literal-names-asi.js (2154B)


      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-async-gen.template
      5 /*---
      6 description: Literal property names with ASI (field definitions after an 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  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.sameValue(c.m, C.prototype.m);
     38 
     39 verifyProperty(C.prototype, "m", {
     40  enumerable: false,
     41  configurable: true,
     42  writable: true,
     43 }, {restore: true});
     44 
     45 c.m().next().then(function(v) {
     46  assert.sameValue(v.value, 42);
     47  assert.sameValue(v.done, true);
     48 
     49  function assertions() {
     50    // Cover $DONE handler for async cases.
     51    function $DONE(error) {
     52      if (error) {
     53        throw new Test262Error('Test262:AsyncTestFailure')
     54      }
     55    }
     56    assert(
     57      !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
     58      "a doesn't appear as an own property on C prototype"
     59    );
     60    assert(
     61      !Object.prototype.hasOwnProperty.call(C, "a"),
     62      "a doesn't appear as an own property on C constructor"
     63    );
     64 
     65    verifyProperty(c, "a", {
     66      value: undefined,
     67      enumerable: true,
     68      writable: true,
     69      configurable: true
     70    });
     71 
     72    assert(
     73      !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     74      "b doesn't appear as an own property on C prototype"
     75    );
     76    assert(
     77      !Object.prototype.hasOwnProperty.call(C, "b"),
     78      "b doesn't appear as an own property on C constructor"
     79    );
     80 
     81    verifyProperty(c, "b", {
     82      value: 42,
     83      enumerable: true,
     84      writable: true,
     85      configurable: true
     86    });
     87  }
     88 
     89  return Promise.resolve(assertions());
     90 }).then($DONE, $DONE);