forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson-usercode.js
More file actions
35 lines (26 loc) · 893 Bytes
/
json-usercode.js
File metadata and controls
35 lines (26 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -O -target=HBC -serializevm-path=%t %s
// RUN: %hermes -O -deserialize-file=%t -target=HBC %s | %FileCheck --match-full-lines %s
// REQUIRES: serializer
// Call some JSON functions just to see if "JSON" is still there.
// JSON constructor is not callable. Serialize directly.
serializeVM(function () {
print(JSON.toString());
//CHECK-LABEL: [object JSON]
// JSON.parse()
print(JSON.parse("5.6") === 5.6);
//CHECK-NEXT: true
print(JSON.parse("true") === true);
//CHECK-NEXT: true
print(JSON.parse("false") === false);
//CHECK-NEXT: true
print(JSON.parse("null") === null);
//CHECK-NEXT: true
print(JSON.parse("\"str\"") === "str");
//CHECK-NEXT: true
})