forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole-count.js
More file actions
44 lines (38 loc) · 915 Bytes
/
console-count.js
File metadata and controls
44 lines (38 loc) · 915 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
39
40
41
42
43
44
/**
* 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.
*
* @format
*/
// RUN: %node-hermes %s 2>&1 | %FileCheck --match-full-lines %s
// REQUIRES: node-hermes
print('Console count functionality');
// CHECK-LABEL: Console count functionality
let user = "";
function greet() {
console.count();
return "hi " + user;
}
user = "bob";
greet();
// CHECK: default: 1
user = "alice";
greet();
// CHECK-NEXT: default: 2
greet();
// CHECK-NEXT: default: 3
console.count();
// CHECK-NEXT: default: 4
console.count('abc');
// CHECK-NEXT: abc: 1
console.count('xyz');
// CHECK-NEXT: xyz: 1
console.count('abc');
// CHECK-NEXT: abc: 2
console.countReset('abc');
console.count('abc');
// CHECK-NEXT: abc: 1
console.countReset('not set');
// CHECK-NEXT: Count for 'not set' does not exist