blob: 1e2c3b0d998bdabb9803e8520a7d649a6279569b (
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
27
28
29
30
31
32
33
|
// Test performing GetModuleNamespace on an errored module.
class MyError {}
async function assertThrowsMyError(f)
{
let caught = false;
try {
await f();
} catch (e) {
caught = true;
assertEq(e.constructor, MyError);
}
assertEq(caught, true);
}
registerModule("a", parseModule(`
throw new MyError();
`));
let c = registerModule("c", parseModule(`
import "a";
`));
c.declarationInstantiation();
assertThrowsMyError(() => c.evaluation());
let b = registerModule('b', parseModule(`
import * as ns0 from 'a'
`));
b.declarationInstantiation();
assertThrowsMyError(() => b.evaluation(b));
drainJobQueue();
|