JS: Add inline test for .shift() method

This commit is contained in:
Asger F
2024-09-11 11:04:41 +02:00
parent 3fcf4ef7a1
commit 3ea1134cc1

View 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
}