Debian Codegraph @

js/src/tests/test262/built-ins/JSON/stringify/value-function.js

raw
1 // Copyright (C) 2012 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-serializejsonproperty
5 description: >
6 Function values are ignored.
7 info: |
8 JSON.stringify ( value [ , replacer [ , space ] ] )
9
10 [...]
11 12. Return ? SerializeJSONProperty(the empty String, wrapper).
12
13 SerializeJSONProperty ( key, holder )
14
15 [...]
16 10. If Type(value) is Object and IsCallable(value) is false, then
17 [...]
18 11. Return undefined.
19 ---*/
20
21 assert.sameValue(JSON.stringify(function() {}), undefined);
22 assert.sameValue(JSON.stringify([function() {}]), '[null]');
23 assert.sameValue(JSON.stringify({key: function() {}}), '{}');
24
25 reportCompare(0, 0);