Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d77c33

Browse files
committed
Test case for spread and rest args/params
1 parent 4cdaccd commit 5d77c33

3 files changed

Lines changed: 178 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
| tst.js:5:14:5:20 | rest[0] | Unexpected result: hasTaintFlow=t1.1 |
2+
| tst.js:5:24:5:45 | // $ ha ... ow=t1.1 | Missing result:hasValueFlow=t1.1 |
3+
| tst.js:6:14:6:20 | rest[1] | Unexpected result: hasTaintFlow=t1.1 |
4+
| tst.js:6:24:6:45 | // $ ha ... ow=t1.2 | Missing result:hasValueFlow=t1.2 |
5+
| tst.js:7:31:7:70 | // $ ha ... ow=t1.2 | Missing result:hasTaintFlow=t1.2 |
6+
| tst.js:15:31:15:70 | // $ ha ... ow=t2.3 | Missing result:hasTaintFlow=t2.3 |
7+
| tst.js:22:14:22:14 | x | Unexpected result: hasTaintFlow=t3.1 |
8+
| tst.js:22:18:22:39 | // $ ha ... ow=t3.1 | Missing result:hasValueFlow=t3.1 |
9+
| tst.js:23:14:23:14 | y | Unexpected result: hasTaintFlow=t3.1 |
10+
| tst.js:23:18:23:39 | // $ ha ... ow=t3.2 | Missing result:hasValueFlow=t3.2 |
11+
| tst.js:24:14:24:14 | z | Unexpected result: hasTaintFlow=t3.1 |
12+
| tst.js:24:18:24:39 | // $ ha ... ow=t3.3 | Missing result:hasValueFlow=t3.3 |
13+
| tst.js:34:14:34:14 | w | Unexpected result: hasTaintFlow=t4.1 |
14+
| tst.js:35:14:35:14 | x | Unexpected result: hasTaintFlow=t4.1 |
15+
| tst.js:35:18:35:39 | // $ ha ... ow=t4.1 | Missing result:hasValueFlow=t4.1 |
16+
| tst.js:36:14:36:14 | y | Unexpected result: hasTaintFlow=t4.1 |
17+
| tst.js:36:18:36:39 | // $ ha ... ow=t4.2 | Missing result:hasValueFlow=t4.2 |
18+
| tst.js:37:14:37:14 | z | Unexpected result: hasTaintFlow=t4.1 |
19+
| tst.js:37:18:37:39 | // $ ha ... ow=t4.3 | Missing result:hasValueFlow=t4.3 |
20+
| tst.js:47:14:47:14 | w | Unexpected result: hasTaintFlow=t5.2 |
21+
| tst.js:47:14:47:14 | w | Unexpected result: hasTaintFlow=t5.3 |
22+
| tst.js:47:14:47:14 | w | Unexpected result: hasValueFlow=t5.1 |
23+
| tst.js:48:14:48:14 | x | Unexpected result: hasTaintFlow=t5.1 |
24+
| tst.js:48:14:48:14 | x | Unexpected result: hasTaintFlow=t5.3 |
25+
| tst.js:48:14:48:14 | x | Unexpected result: hasValueFlow=t5.2 |
26+
| tst.js:48:18:48:39 | // $ ha ... ow=t5.1 | Missing result:hasValueFlow=t5.1 |
27+
| tst.js:49:14:49:14 | y | Unexpected result: hasTaintFlow=t5.1 |
28+
| tst.js:49:14:49:14 | y | Unexpected result: hasTaintFlow=t5.2 |
29+
| tst.js:49:14:49:14 | y | Unexpected result: hasValueFlow=t5.3 |
30+
| tst.js:49:18:49:39 | // $ ha ... ow=t5.2 | Missing result:hasValueFlow=t5.2 |
31+
| tst.js:50:14:50:14 | z | Unexpected result: hasTaintFlow=t5.1 |
32+
| tst.js:50:14:50:14 | z | Unexpected result: hasTaintFlow=t5.2 |
33+
| tst.js:50:14:50:14 | z | Unexpected result: hasTaintFlow=t5.3 |
34+
| tst.js:50:18:50:39 | // $ ha ... ow=t5.3 | Missing result:hasValueFlow=t5.3 |
35+
| tst.js:61:28:61:49 | // $ ha ... ow=t6.1 | Missing result:hasValueFlow=t6.1 |
36+
| tst.js:62:28:62:49 | // $ ha ... ow=t6.2 | Missing result:hasValueFlow=t6.2 |
37+
| tst.js:63:28:63:49 | // $ ha ... ow=t6.3 | Missing result:hasValueFlow=t6.3 |
38+
| tst.js:70:18:70:39 | // $ ha ... ow=t7.1 | Missing result:hasValueFlow=t7.1 |
39+
| tst.js:71:18:71:39 | // $ ha ... ow=t7.2 | Missing result:hasValueFlow=t7.2 |
40+
| tst.js:72:18:72:39 | // $ ha ... ow=t7.3 | Missing result:hasValueFlow=t7.3 |
41+
| tst.js:82:14:82:14 | x | Unexpected result: hasTaintFlow=t8.2 |
42+
| tst.js:82:14:82:14 | x | Unexpected result: hasTaintFlow=t8.4 |
43+
| tst.js:83:14:83:14 | y | Unexpected result: hasTaintFlow=t8.1 |
44+
| tst.js:83:14:83:14 | y | Unexpected result: hasTaintFlow=t8.3 |
45+
| tst.js:83:18:83:85 | // $ ha ... ow=t8.4 | Fixed spurious result:hasValueFlow=t8.3 |
46+
| tst.js:84:14:84:14 | z | Unexpected result: hasTaintFlow=t8.1 |
47+
| tst.js:84:14:84:14 | z | Unexpected result: hasTaintFlow=t8.2 |
48+
| tst.js:84:14:84:14 | z | Unexpected result: hasTaintFlow=t8.3 |
49+
| tst.js:84:14:84:14 | z | Unexpected result: hasTaintFlow=t8.4 |
50+
| tst.js:84:18:84:85 | // $ ha ... ow=t8.4 | Fixed spurious result:hasValueFlow=t8.3 |
51+
| tst.js:84:18:84:85 | // $ ha ... ow=t8.4 | Fixed spurious result:hasValueFlow=t8.4 |
52+
| tst.js:84:18:84:85 | // $ ha ... ow=t8.4 | Missing result:hasValueFlow=t8.3 |
53+
| tst.js:94:18:94:39 | // $ ha ... ow=t9.1 | Missing result:hasValueFlow=t9.1 |
54+
| tst.js:95:18:95:39 | // $ ha ... ow=t9.2 | Missing result:hasValueFlow=t9.2 |
55+
| tst.js:96:18:96:39 | // $ ha ... ow=t9.3 | Missing result:hasValueFlow=t9.3 |
56+
| tst.js:106:14:106:14 | x | Unexpected result: hasTaintFlow=t10.1 |
57+
| tst.js:106:18:106:40 | // $ ha ... w=t10.1 | Missing result:hasValueFlow=t10.1 |
58+
| tst.js:107:14:107:14 | y | Unexpected result: hasTaintFlow=t10.1 |
59+
| tst.js:107:18:107:40 | // $ ha ... w=t10.2 | Missing result:hasValueFlow=t10.2 |
60+
| tst.js:108:14:108:14 | z | Unexpected result: hasTaintFlow=t10.1 |
61+
| tst.js:108:18:108:40 | // $ ha ... w=t10.3 | Missing result:hasValueFlow=t10.3 |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import javascript
2+
import testUtilities.InlineFlowTest
3+
import DefaultFlowTest
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import 'dummy';
2+
3+
function t1() {
4+
function target(...rest) {
5+
sink(rest[0]); // $ hasValueFlow=t1.1
6+
sink(rest[1]); // $ hasValueFlow=t1.2
7+
sink(rest.join(',')); // $ hasTaintFlow=t1.1 hasTaintFlow=t1.2
8+
}
9+
target(source('t1.1'), source('t1.2'));
10+
}
11+
12+
function t2() {
13+
function target(x, ...rest) {
14+
sink(x); // $ hasValueFlow=t2.1
15+
sink(rest.join(',')); // $ hasTaintFlow=t2.2 hasTaintFlow=t2.3
16+
}
17+
target(source('t2.1'), source('t2.2'), source('t2.3'));
18+
}
19+
20+
function t3() {
21+
function finalTarget(x, y, z) {
22+
sink(x); // $ hasValueFlow=t3.1
23+
sink(y); // $ hasValueFlow=t3.2
24+
sink(z); // $ hasValueFlow=t3.3
25+
}
26+
function target(...rest) {
27+
finalTarget(...rest);
28+
}
29+
target(source('t3.1'), source('t3.2'), source('t3.3'));
30+
}
31+
32+
function t4() {
33+
function finalTarget(w, x, y, z) {
34+
sink(w); // $ hasValueFlow=t4.0
35+
sink(x); // $ hasValueFlow=t4.1
36+
sink(y); // $ hasValueFlow=t4.2
37+
sink(z); // $ hasValueFlow=t4.3
38+
}
39+
function target(...rest) {
40+
finalTarget(source('t4.0'), ...rest);
41+
}
42+
target(source('t4.1'), source('t4.2'), source('t4.3'));
43+
}
44+
45+
function t5() {
46+
function finalTarget(w, x, y, z) {
47+
sink(w); // $ hasValueFlow=t5.0
48+
sink(x); // $ hasValueFlow=t5.1
49+
sink(y); // $ hasValueFlow=t5.2
50+
sink(z); // $ hasValueFlow=t5.3
51+
}
52+
function target(array) {
53+
finalTarget(source('t5.0'), ...array);
54+
}
55+
target([source('t5.1'), source('t5.2'), source('t5.3')]);
56+
}
57+
58+
function t6() {
59+
function target(x) {
60+
sink(x); // $ hasValueFlow=t6.1
61+
sink(arguments[0]);// $ hasValueFlow=t6.1
62+
sink(arguments[1]);// $ hasValueFlow=t6.2
63+
sink(arguments[2]);// $ hasValueFlow=t6.3
64+
}
65+
target(source('t6.1'), source('t6.2'), source('t6.3'));
66+
}
67+
68+
function t7() {
69+
function finalTarget(x, y, z) {
70+
sink(x); // $ hasValueFlow=t7.1
71+
sink(y); // $ hasValueFlow=t7.2
72+
sink(z); // $ hasValueFlow=t7.3
73+
}
74+
function target() {
75+
finalTarget(...arguments);
76+
}
77+
target(source('t7.1'), source('t7.2'), source('t7.3'));
78+
}
79+
80+
function t8() {
81+
function finalTarget(x, y, z) {
82+
sink(x); // $ hasValueFlow=t8.1 SPURIOUS: hasValueFlow=t8.3
83+
sink(y); // $ hasValueFlow=t8.2 SPURIOUS: hasValueFlow=t8.3 hasValueFlow=t8.4
84+
sink(z); // $ hasValueFlow=t8.3 SPURIOUS: hasValueFlow=t8.3 hasValueFlow=t8.4
85+
}
86+
function target(array1, array2) {
87+
finalTarget(...array1, ...array2);
88+
}
89+
target([source('t8.1'), source('t8.2')], [source('t8.3'), source('t8.4')]);
90+
}
91+
92+
function t9() {
93+
function finalTarget(x, y, z) {
94+
sink(x); // $ hasValueFlow=t9.1
95+
sink(y); // $ hasValueFlow=t9.2
96+
sink(z); // $ hasValueFlow=t9.3
97+
}
98+
function target() {
99+
finalTarget.apply(undefined, arguments);
100+
}
101+
target(source('t9.1'), source('t9.2'), source('t9.3'));
102+
}
103+
104+
function t10() {
105+
function finalTarget(x, y, z) {
106+
sink(x); // $ hasValueFlow=t10.1
107+
sink(y); // $ hasValueFlow=t10.2
108+
sink(z); // $ hasValueFlow=t10.3
109+
}
110+
function target(...rest) {
111+
finalTarget.apply(undefined, rest);
112+
}
113+
target(source('t10.1'), source('t10.2'), source('t10.3'));
114+
}

0 commit comments

Comments
 (0)