tor-browser

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

text-negative-zero.js (782B)


      1 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-json.parse
      5 description: >
      6  Top-level negative zero surrounded by whitespace is parsed correctly.
      7 info: |
      8  JSON.parse ( text [ , reviver ] )
      9 
     10  1. Let JText be ? ToString(text).
     11  2. Parse JText interpreted as UTF-16 encoded Unicode points (6.1.4) as a JSON
     12  text as specified in ECMA-404. Throw a SyntaxError exception if JText is not
     13  a valid JSON text as defined in that specification.
     14 ---*/
     15 
     16 assert.sameValue(JSON.parse('-0'), -0);
     17 assert.sameValue(JSON.parse(' \n-0'), -0);
     18 assert.sameValue(JSON.parse('-0  \t'), -0);
     19 assert.sameValue(JSON.parse('\n\t -0\n   '), -0);
     20 
     21 assert.sameValue(JSON.parse(-0), 0);
     22 
     23 reportCompare(0, 0);