summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/array-shrink-during-find-crash.js
blob: 16a041a8e7a54305eb1f1ff0f24f38ff887c2a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
load("test-common.js");

try {
    var a, callbackCalled;

    callbackCalled = 0;
    a = [1, 2, 3, 4, 5];
    a.find(() => {
        callbackCalled++;
        a.pop();
    });
    assert(callbackCalled === 5);

    callbackCalled = 0;
    a = [1, 2, 3, 4, 5];
    a.findIndex(() => {
        callbackCalled++;
        a.pop();
    });
    assert(callbackCalled === 5);

    console.log("PASS");
} catch (e) {
    console.log("FAIL: " + e);
}