tor-browser

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

S9.9_A6.js (933B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    ToObject conversion from Object: The result is the input
      7    argument (no conversion)
      8 es5id: 9.9_A6
      9 description: Converting from Objects to Object
     10 ---*/
     11 
     12 function MyObject(val) {
     13  this.value = val;
     14  this.valueOf = function() {
     15    return this.value;
     16  }
     17 }
     18 
     19 var x = new MyObject(1);
     20 var y = Object(x);
     21 
     22 assert.sameValue(y.valueOf(), x.valueOf(), 'y.valueOf() must return the same value returned by x.valueOf()');
     23 assert.sameValue(typeof y, typeof x, 'The value of `typeof y` is expected to be typeof x');
     24 
     25 assert.sameValue(
     26  y.constructor.prototype,
     27  x.constructor.prototype,
     28  'The value of y.constructor.prototype is expected to equal the value of x.constructor.prototype'
     29 );
     30 
     31 assert.sameValue(y, x, 'The value of y is expected to equal the value of x');
     32 
     33 reportCompare(0, 0);