mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
JS: Add inline test for .shift() method
This commit is contained in:
15
javascript/ql/test/library-tests/TripleDot/arrays.js
Normal file
15
javascript/ql/test/library-tests/TripleDot/arrays.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'dummy';
|
||||
|
||||
function shiftKnown() {
|
||||
let array = [source('shift.1'), source('shift.2')];
|
||||
sink(array.shift()); // $ hasValueFlow=shift.1
|
||||
sink(array.shift()); // $ SPURIOUS: hasValueFlow=shift.1 MISSING: hasValueFlow=shift.2
|
||||
}
|
||||
|
||||
function shiftUnknown() {
|
||||
const array = new Array(Math.floor(Math.random() * 10));
|
||||
array.push(source('shift.unkn'));
|
||||
sink(array.shift()); // $ hasValueFlow=shift.unkn
|
||||
sink(array.shift()); // $ hasValueFlow=shift.unkn
|
||||
sink(array.shift()); // $ hasValueFlow=shift.unkn
|
||||
}
|
||||
Reference in New Issue
Block a user