blob: 41de22af2029731be8408f334a2504f739a56370 (
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
34
35
36
37
38
39
40
41
42
43
|
'use strict';
const common = require('../common');
const assert = require('assert');
const domain = require('domain');
{
const d = new domain.Domain();
const mustNotCall = common.mustNotCall();
d.on('error', common.mustCall((err) => {
assert.strictEqual(err.message, 'foobar');
assert.strictEqual(err.domain, d);
assert.strictEqual(err.domainEmitter, undefined);
assert.strictEqual(err.domainBound, mustNotCall);
assert.strictEqual(err.domainThrown, false);
}));
const bound = d.intercept(mustNotCall);
bound(new Error('foobar'));
}
{
const d = new domain.Domain();
const bound = d.intercept(common.mustCall((data) => {
assert.strictEqual(data, 'data');
}));
bound(null, 'data');
}
{
const d = new domain.Domain();
const bound = d.intercept(common.mustCall((data, data2) => {
assert.strictEqual(data, 'data');
assert.strictEqual(data2, 'data2');
}));
bound(null, 'data', 'data2');
}
|