aboutsummaryrefslogtreecommitdiff
path: root/test/js/async_recursive_last.t.js
blob: 84f1b5792c55cb9620de9c317fc655d409580c0a (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
26
/*---
includes: [compareArray.js]
flags: [async]
---*/

let stages = [];

async function f(v) {
    if (v == 3) {
        return;
    }

    stages.push(`f>${v}`);

    f(v + 1);

    stages.push(`f<${v}`);

    await "X";
}

f(0)
.then(v => {
    assert.compareArray(stages, ['f>0', 'f>1', 'f>2', 'f<2', 'f<1', 'f<0']);
})
.then($DONE, $DONE);