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

Skip to content

Commit 96f1d91

Browse files
committed
JS: Add a new test
1 parent 69a048d commit 96f1d91

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as dummy from 'dummy';
2+
3+
function F() {
4+
this.init();
5+
}
6+
7+
F.prototype.init = function() {
8+
this.method();
9+
let m = this.method.bind(this);
10+
m();
11+
};
12+
13+
F.prototype.method = function() {};
14+
15+
export default F;

javascript/ql/test/library-tests/CallGraphs/tests.expected

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ test_isUncertain
1212
| n.js:2:1:2:5 | m.f() |
1313
| n.js:4:10:4:24 | require('./m2') |
1414
| n.js:5:1:5:6 | m2.f() |
15+
| protoclass.js:4:3:4:13 | this.init() |
16+
| protoclass.js:8:3:8:15 | this.method() |
17+
| protoclass.js:9:11:9:32 | this.me ... d(this) |
18+
| protoclass.js:10:3:10:5 | m() |
1519
| reflection.js:7:1:7:22 | add.cal ... 23, 19) |
1620
| reflection.js:8:1:8:25 | add.app ... 3, 19]) |
1721
| tst.js:6:1:6:3 | f() |
@@ -86,6 +90,15 @@ test_getAFunctionValue
8690
| m.js:3:1:3:16 | module.exports.f | m.js:1:13:1:25 | function() {} |
8791
| n.js:2:1:2:3 | m.f | m.js:1:13:1:25 | function() {} |
8892
| n.js:5:1:5:4 | m2.f | m2.js:2:6:2:18 | function() {} |
93+
| protoclass.js:3:1:5:1 | functio ... it();\\n} | protoclass.js:3:1:5:1 | functio ... it();\\n} |
94+
| protoclass.js:3:10:3:10 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
95+
| protoclass.js:7:1:7:1 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
96+
| protoclass.js:7:1:11:1 | F.proto ... m();\\n} | protoclass.js:7:20:11:1 | functio ... m();\\n} |
97+
| protoclass.js:7:20:11:1 | functio ... m();\\n} | protoclass.js:7:20:11:1 | functio ... m();\\n} |
98+
| protoclass.js:13:1:13:1 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
99+
| protoclass.js:13:1:13:34 | F.proto ... on() {} | protoclass.js:13:22:13:34 | function() {} |
100+
| protoclass.js:13:22:13:34 | function() {} | protoclass.js:13:22:13:34 | function() {} |
101+
| protoclass.js:15:16:15:16 | F | protoclass.js:3:1:5:1 | functio ... it();\\n} |
89102
| reflection.js:1:1:3:1 | functio ... x+y;\\n} | reflection.js:1:1:3:1 | functio ... x+y;\\n} |
90103
| reflection.js:5:3:5:5 | add | reflection.js:1:1:3:1 | functio ... x+y;\\n} |
91104
| reflection.js:5:3:5:39 | add.app ... n 56; } | reflection.js:5:15:5:39 | functio ... n 56; } |
@@ -176,6 +189,7 @@ test_getArgument
176189
| es2015.js:36:1:36:17 | sum(1, ...[2], 3) | 0 | es2015.js:36:5:36:5 | 1 |
177190
| n.js:1:9:1:22 | require('./m') | 0 | n.js:1:17:1:21 | './m' |
178191
| n.js:4:10:4:24 | require('./m2') | 0 | n.js:4:18:4:23 | './m2' |
192+
| protoclass.js:9:11:9:32 | this.me ... d(this) | 0 | protoclass.js:9:28:9:31 | this |
179193
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | 0 | reflection.js:7:10:7:13 | null |
180194
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | 1 | reflection.js:7:16:7:17 | 23 |
181195
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | 2 | reflection.js:7:20:7:21 | 19 |
@@ -207,6 +221,10 @@ test_getNumArgument
207221
| n.js:2:1:2:5 | m.f() | 0 |
208222
| n.js:4:10:4:24 | require('./m2') | 1 |
209223
| n.js:5:1:5:6 | m2.f() | 0 |
224+
| protoclass.js:4:3:4:13 | this.init() | 0 |
225+
| protoclass.js:8:3:8:15 | this.method() | 0 |
226+
| protoclass.js:9:11:9:32 | this.me ... d(this) | 1 |
227+
| protoclass.js:10:3:10:5 | m() | 0 |
210228
| reflection.js:4:5:4:12 | sneaky() | 0 |
211229
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | 3 |
212230
| reflection.js:7:1:7:22 | reflective call | 2 |
@@ -252,6 +270,10 @@ test_isIncomplete
252270
| n.js:2:1:2:5 | m.f() |
253271
| n.js:4:10:4:24 | require('./m2') |
254272
| n.js:5:1:5:6 | m2.f() |
273+
| protoclass.js:4:3:4:13 | this.init() |
274+
| protoclass.js:8:3:8:15 | this.method() |
275+
| protoclass.js:9:11:9:32 | this.me ... d(this) |
276+
| protoclass.js:10:3:10:5 | m() |
255277
| reflection.js:7:1:7:22 | add.cal ... 23, 19) |
256278
| reflection.js:8:1:8:25 | add.app ... 3, 19]) |
257279
| tst.js:6:1:6:3 | f() |
@@ -295,6 +317,10 @@ test_getCalleeNode
295317
| n.js:2:1:2:5 | m.f() | n.js:2:1:2:3 | m.f |
296318
| n.js:4:10:4:24 | require('./m2') | n.js:4:10:4:16 | require |
297319
| n.js:5:1:5:6 | m2.f() | n.js:5:1:5:4 | m2.f |
320+
| protoclass.js:4:3:4:13 | this.init() | protoclass.js:4:3:4:11 | this.init |
321+
| protoclass.js:8:3:8:15 | this.method() | protoclass.js:8:3:8:13 | this.method |
322+
| protoclass.js:9:11:9:32 | this.me ... d(this) | protoclass.js:9:11:9:26 | this.method.bind |
323+
| protoclass.js:10:3:10:5 | m() | protoclass.js:10:3:10:3 | m |
298324
| reflection.js:4:5:4:12 | sneaky() | reflection.js:4:5:4:10 | sneaky |
299325
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | reflection.js:7:1:7:8 | add.call |
300326
| reflection.js:7:1:7:22 | reflective call | reflection.js:7:1:7:3 | add |
@@ -334,6 +360,7 @@ test_getLastArgument
334360
| es2015.js:27:5:27:23 | console.log(this.x) | es2015.js:27:17:27:22 | this.x |
335361
| n.js:1:9:1:22 | require('./m') | n.js:1:17:1:21 | './m' |
336362
| n.js:4:10:4:24 | require('./m2') | n.js:4:18:4:23 | './m2' |
363+
| protoclass.js:9:11:9:32 | this.me ... d(this) | protoclass.js:9:28:9:31 | this |
337364
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | reflection.js:7:20:7:21 | 19 |
338365
| reflection.js:7:1:7:22 | reflective call | reflection.js:7:20:7:21 | 19 |
339366
| reflection.js:8:1:8:25 | add.app ... 3, 19]) | reflection.js:8:17:8:24 | [23, 19] |
@@ -349,6 +376,7 @@ test_getAnArgument
349376
| es2015.js:36:1:36:17 | sum(1, ...[2], 3) | es2015.js:36:16:36:16 | 3 |
350377
| n.js:1:9:1:22 | require('./m') | n.js:1:17:1:21 | './m' |
351378
| n.js:4:10:4:24 | require('./m2') | n.js:4:18:4:23 | './m2' |
379+
| protoclass.js:9:11:9:32 | this.me ... d(this) | protoclass.js:9:28:9:31 | this |
352380
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | reflection.js:7:10:7:13 | null |
353381
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | reflection.js:7:16:7:17 | 23 |
354382
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | reflection.js:7:20:7:21 | 19 |
@@ -430,6 +458,10 @@ test_getCalleeName
430458
| n.js:2:1:2:5 | m.f() | f |
431459
| n.js:4:10:4:24 | require('./m2') | require |
432460
| n.js:5:1:5:6 | m2.f() | f |
461+
| protoclass.js:4:3:4:13 | this.init() | init |
462+
| protoclass.js:8:3:8:15 | this.method() | method |
463+
| protoclass.js:9:11:9:32 | this.me ... d(this) | bind |
464+
| protoclass.js:10:3:10:5 | m() | m |
433465
| reflection.js:4:5:4:12 | sneaky() | sneaky |
434466
| reflection.js:7:1:7:22 | add.cal ... 23, 19) | call |
435467
| reflection.js:8:1:8:25 | add.app ... 3, 19]) | apply |

0 commit comments

Comments
 (0)