summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/JSON/stringify-toJSON-arguments.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/ecma_5/JSON/stringify-toJSON-arguments.js')
-rw-r--r--js/src/tests/ecma_5/JSON/stringify-toJSON-arguments.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/tests/ecma_5/JSON/stringify-toJSON-arguments.js b/js/src/tests/ecma_5/JSON/stringify-toJSON-arguments.js
new file mode 100644
index 000000000..7c2013d58
--- /dev/null
+++ b/js/src/tests/ecma_5/JSON/stringify-toJSON-arguments.js
@@ -0,0 +1,34 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+var gTestfile = 'stringify-toJSON-arguments.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 584909;
+var summary = "Arguments when an object's toJSON method is called";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var obj =
+ {
+ p: {
+ toJSON: function(key)
+ {
+ assertEq(arguments.length, 1);
+ assertEq(key, "p");
+ return 17;
+ }
+ }
+ };
+
+assertEq(JSON.stringify(obj), '{"p":17}');
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");