tor-browser

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

same-line-method-string-literal-names.js (2371B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/string-literal-names.case
      3 // - src/class-elements/productions/cls-decl-same-line-method.template
      4 /*---
      5 description: String literal names (field definitions followed by a method in the same line)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-public, class]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    ClassElement:
     12      ...
     13      FieldDefinition ;
     14 
     15    FieldDefinition:
     16      ClassElementName Initializer_opt
     17 
     18    ClassElementName:
     19      PropertyName
     20 
     21 ---*/
     22 
     23 
     24 class C {
     25  'a'; "b"; 'c' = 39;
     26  "d" = 42; m() { return 42; }
     27  
     28 }
     29 
     30 var c = new C();
     31 
     32 assert.sameValue(c.m(), 42);
     33 assert.sameValue(c.m, C.prototype.m);
     34 assert(
     35  !Object.prototype.hasOwnProperty.call(c, "m"),
     36  "m doesn't appear as an own property on the C instance"
     37 );
     38 
     39 verifyProperty(C.prototype, "m", {
     40  enumerable: false,
     41  configurable: true,
     42  writable: true,
     43 });
     44 
     45 assert(
     46  !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
     47  "a does not appear as an own property on C prototype"
     48 );
     49 assert(
     50  !Object.prototype.hasOwnProperty.call(C, "a"),
     51  "a does not appear as an own property on C constructor"
     52 );
     53 
     54 verifyProperty(c, "a", {
     55  value: undefined,
     56  enumerable: true,
     57  writable: true,
     58  configurable: true
     59 });
     60 
     61 assert(
     62  !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     63  "b does not appear as an own property on C prototype"
     64 );
     65 assert(
     66  !Object.prototype.hasOwnProperty.call(C, "b"),
     67  "b does not appear as an own property on C constructor"
     68 );
     69 
     70 verifyProperty(c, "b", {
     71  value: undefined,
     72  enumerable: true,
     73  writable: true,
     74  configurable: true
     75 });
     76 
     77 assert(
     78  !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
     79  "c does not appear as an own property on C prototype"
     80 );
     81 assert(
     82  !Object.prototype.hasOwnProperty.call(C, "c"),
     83  "c does not appear as an own property on C constructor"
     84 );
     85 
     86 verifyProperty(c, "c", {
     87  value: 39,
     88  enumerable: true,
     89  writable: true,
     90  configurable: true
     91 });
     92 
     93 assert(
     94  !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
     95  "d does not appear as an own property on C prototype"
     96 );
     97 assert(
     98  !Object.prototype.hasOwnProperty.call(C, "d"),
     99  "d does not appear as an own property on C constructor"
    100 );
    101 
    102 verifyProperty(c, "d", {
    103  value: 42,
    104  enumerable: true,
    105  writable: true,
    106  configurable: true
    107 });
    108 
    109 reportCompare(0, 0);