forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror-usercode.js
More file actions
49 lines (40 loc) · 1.15 KB
/
error-usercode.js
File metadata and controls
49 lines (40 loc) · 1.15 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* 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
var e = new Error();
var e2 = new Error();
e2.name = 'RandomError';
e2.message = 'random-message';
var e3 = new TypeError();
serializeVM(function() {
print(e);
//CHECK: Error
print(e.hasOwnProperty(e, 'name'));
//CHECK: false
print(e.hasOwnProperty(e, 'message'));
//CHECK: false
print(e.__proto__.hasOwnProperty('name'));
//CHECK: true
print(e.__proto__.hasOwnProperty('message'));
//CHECK: true
e2.name = 'RandomError';
e2.message = 'random-message';
print(e2);
//CHECK: RandomError: random-message
print(e3);
//CHECK: TypeError
print(e3.hasOwnProperty(e, 'name'));
//CHECK: false
print(e3.hasOwnProperty(e, 'message'));
//CHECK: false
print(e3.__proto__.hasOwnProperty('name'));
//CHECK: true
print(e3.__proto__.hasOwnProperty('message'));
//CHECK: true
})