summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/JSON/stringify/value-function.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/JSON/stringify/value-function.js')
-rw-r--r--js/src/tests/test262/built-ins/JSON/stringify/value-function.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/JSON/stringify/value-function.js b/js/src/tests/test262/built-ins/JSON/stringify/value-function.js
new file mode 100644
index 0000000000..e4b18d857f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/JSON/stringify/value-function.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-serializejsonproperty
+description: >
+ Function values are ignored.
+info: |
+ JSON.stringify ( value [ , replacer [ , space ] ] )
+
+ [...]
+ 12. Return ? SerializeJSONProperty(the empty String, wrapper).
+
+ SerializeJSONProperty ( key, holder )
+
+ [...]
+ 10. If Type(value) is Object and IsCallable(value) is false, then
+ [...]
+ 11. Return undefined.
+---*/
+
+assert.sameValue(JSON.stringify(function() {}), undefined);
+assert.sameValue(JSON.stringify([function() {}]), '[null]');
+assert.sameValue(JSON.stringify({key: function() {}}), '{}');
+
+reportCompare(0, 0);