Skip to content

Commit 3ea1134

Browse files
committed
JS: Add inline test for .shift() method
1 parent 3fcf4ef commit 3ea1134

File tree

1 file changed

+15
-0
lines changed
  • javascript/ql/test/library-tests/TripleDot

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import 'dummy';
2+
3+
function shiftKnown() {
4+
let array = [source('shift.1'), source('shift.2')];
5+
sink(array.shift()); // $ hasValueFlow=shift.1
6+
sink(array.shift()); // $ SPURIOUS: hasValueFlow=shift.1 MISSING: hasValueFlow=shift.2
7+
}
8+
9+
function shiftUnknown() {
10+
const array = new Array(Math.floor(Math.random() * 10));
11+
array.push(source('shift.unkn'));
12+
sink(array.shift()); // $ hasValueFlow=shift.unkn
13+
sink(array.shift()); // $ hasValueFlow=shift.unkn
14+
sink(array.shift()); // $ hasValueFlow=shift.unkn
15+
}

0 commit comments

Comments
 (0)