~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/tests/ecma_5/JSON/stringify-call-toJSON-once.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Any copyright is dedicated to the Public Domain.
 
2
// http://creativecommons.org/licenses/publicdomain/
 
3
 
 
4
var gTestfile = 'stringify-call-toJSON-once.js';
 
5
//-----------------------------------------------------------------------------
 
6
var BUGNUMBER = 584909;
 
7
var summary = "Stringification of Boolean/String/Number objects";
 
8
 
 
9
print(BUGNUMBER + ": " + summary);
 
10
 
 
11
/**************
 
12
 * BEGIN TEST *
 
13
 **************/
 
14
 
 
15
var obj =
 
16
  {
 
17
    p: {
 
18
         toJSON: function()
 
19
         {
 
20
           return { toJSON: function() { return 17; } };
 
21
         }
 
22
       }
 
23
  };
 
24
 
 
25
assertEq(JSON.stringify(obj), '{"p":{}}');
 
26
 
 
27
/******************************************************************************/
 
28
 
 
29
if (typeof reportCompare === "function")
 
30
  reportCompare(true, true);
 
31
 
 
32
print("Tests complete");