blob: 0362ffce3d5b422d08a8d33b1ae3685118d953be (
about) (
plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
negate_iife_1: {
options = {
negate_iife: true
};
input: {
(function(){ stuff() })();
}
expect: {
!function(){ stuff() }();
}
}
negate_iife_2: {
options = {
negate_iife: true
};
input: {
(function(){ return {} })().x = 10; // should not transform this one
}
expect: {
(function(){ return {} })().x = 10;
}
}
negate_iife_3: {
options = {
negate_iife: true,
};
input: {
(function(){ return true })() ? console.log(true) : console.log(false);
}
expect: {
!function(){ return true }() ? console.log(false) : console.log(true);
}
}
negate_iife_3: {
options = {
negate_iife: true,
sequences: true
};
input: {
(function(){ return true })() ? console.log(true) : console.log(false);
(function(){
console.log("something");
})();
}
expect: {
!function(){ return true }() ? console.log(false) : console.log(true), function(){
console.log("something");
}();
}
}
negate_iife_4: {
options = {
negate_iife: true,
sequences: true,
conditionals: true,
};
input: {
if ((function(){ return true })()) {
console.log(true);
} else {
console.log(false);
}
(function(){
console.log("something");
})();
}
expect: {
!function(){ return true }() ? console.log(false) : console.log(true), function(){
console.log("something");
}();
}
}
|