forked from terser/terser
/
identity.js
61 lines (58 loc) 路 1.1 KB
/
identity.js
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
50
51
52
53
54
55
56
57
58
59
60
61
inline_identity: {
options = {
defaults: true,
toplevel: true
}
input: {
const id = x => x;
console.log(id(1), id(2));
}
expect: {
console.log(1, 2);
}
expect_stdout: "1 2"
}
inline_identity_no_params: {
options = {
defaults: true,
toplevel: true
}
input: {
const id = x => x;
console.log(id(), id());
}
expect: {
console.log(void 0, void 0);
}
expect_stdout: "undefined undefined"
}
inline_identity_extra_params: {
options = {
defaults: true,
toplevel: true
}
input: {
const id = x => x;
console.log(id(1, 2), id(3, 4));
}
expect: {
console.log(1, 3);
}
expect_stdout: "1 3"
}
inline_identity_higher_order: {
options = {
defaults: true,
toplevel: true
}
input: {
const id = x => x;
const inc = x => x + 1;
console.log(id(inc)(1), id(inc)(2));
}
expect: {
const inc = x => x + 1;
console.log(inc(1), inc(2));
}
expect_stdout: "2 3"
}