tor-browser

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

basics.js (1382B)


      1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 14.5
      5 description: >
      6    class basics
      7 ---*/
      8 var C = class C {}
      9 assert.sameValue(typeof C, 'function', "`typeof C` is `'function'`");
     10 assert.sameValue(
     11    Object.getPrototypeOf(C.prototype),
     12    Object.prototype,
     13    "`Object.getPrototypeOf(C.prototype)` returns `Object.prototype`"
     14 );
     15 assert.sameValue(
     16    Object.getPrototypeOf(C),
     17    Function.prototype,
     18    "`Object.getPrototypeOf(C)` returns `Function.prototype`"
     19 );
     20 assert.sameValue(C.name, 'C', "The value of `C.name` is `'C'`");
     21 
     22 class D {}
     23 assert.sameValue(typeof D, 'function', "`typeof D` is `'function'`");
     24 assert.sameValue(
     25    Object.getPrototypeOf(D.prototype),
     26    Object.prototype,
     27    "`Object.getPrototypeOf(D.prototype)` returns `Object.prototype`"
     28 );
     29 assert.sameValue(
     30    Object.getPrototypeOf(D),
     31    Function.prototype,
     32    "`Object.getPrototypeOf(D)` returns `Function.prototype`"
     33 );
     34 assert.sameValue(D.name, 'D', "The value of `D.name` is `'D'`");
     35 
     36 class D2 { constructor() {} }
     37 assert.sameValue(D2.name, 'D2', "The value of `D2.name` is `'D2'`");
     38 
     39 var E = class {}
     40 assert.sameValue(E.name, 'E', "The value of `E.name` is `'E'`");
     41 
     42 var F = class { constructor() {} };
     43 assert.sameValue(F.name, 'F', "The value of `F.name` is `'F'`");
     44 
     45 reportCompare(0, 0);