tor-browser

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

assert-samevalue-zeros.js (650B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: >
      6    Positive and negative zero do not satisfy the assertion.
      7 ---*/
      8 
      9 var threw = false;
     10 
     11 try {
     12  assert.sameValue(0, -0);
     13 } catch(err) {
     14  threw = true;
     15  if (err.constructor !== Test262Error) {
     16    throw new Error(
     17      'Expected a Test262Error, but a "' + err.constructor.name +
     18      '" was thrown.'
     19    );
     20  }
     21  assert.notSameValue(err.message.indexOf('-0'), -1);
     22 }
     23 
     24 if (threw === false) {
     25  throw new Error('Expected a Test262Error, but no error was thrown.');
     26 }
     27 
     28 reportCompare(0, 0);