MCPcopy Index your code
hub / github.com/nodejs/node / check

Function check

test/parallel/test-stream-readable-didRead.js:8–39  ·  view source on GitHub ↗
(readable, data, fn)

Source from the content-addressed store, hash-verified

6function noop() {}
7
8function check(readable, data, fn) {
9 assert.strictEqual(readable.readableDidRead, false);
10 assert.strictEqual(isDisturbed(readable), false);
11 assert.strictEqual(isErrored(readable), false);
12 if (data === -1) {
13 readable.on('error', common.mustCall(() => {
14 assert.strictEqual(isErrored(readable), true);
15 }));
16 readable.on('data', common.mustNotCall());
17 readable.on('end', common.mustNotCall());
18 } else {
19 readable.on('error', common.mustNotCall());
20 if (data === -2) {
21 readable.on('end', common.mustNotCall());
22 } else {
23 readable.on('end', common.mustCall());
24 }
25 if (data > 0) {
26 readable.on('data', common.mustCallAtLeast(data));
27 } else {
28 readable.on('data', common.mustNotCall());
29 }
30 }
31 readable.on('close', common.mustCall());
32 fn();
33 setImmediate(common.mustCall(() => {
34 assert.strictEqual(readable.readableDidRead, data > 0);
35 if (data > 0) {
36 assert.strictEqual(isDisturbed(readable), true);
37 }
38 }));
39}
40
41{
42 const readable = new Readable({

Callers 1

Calls 5

isErroredFunction · 0.85
fnFunction · 0.70
isDisturbedFunction · 0.50
setImmediateFunction · 0.50
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…