forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-usercode.js
More file actions
38 lines (32 loc) · 850 Bytes
/
set-usercode.js
File metadata and controls
38 lines (32 loc) · 850 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
36
37
38
/**
* 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 s = new Set()
var s1 = new Set(new Set([1, 2]));
var s2 = new Set();
s2.add(undefined);
s2.add("abc");
var s3 = new Set([,10,20,,,30,10,,]);
serializeVM(function() {
print(s);
//CHECK: [object Set]
print(s1.has(1), s1.has(2), s1.has(3));
//CHECK-NEXT: true true false
// Test some Set functions
print(s2.size);
//CHECK-NEXT: 2
s2.add("cde")
print(s2.size)
//CHECK-NEXT: 3
s2.add("abc")
print(s2.size)
//CHECK-NEXT: 3
print(s3.size);
//CHECK-NEXT: 4
})