| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -284,3 +284,17 @@ const assert = require('assert'); | |||
| 284 | 284 | duplex.on('close', common.mustCall()); | |
| 285 | 285 | duplex[Symbol.asyncDispose]().then(common.mustCall()); | |
| 286 | 286 | } | |
| 287 | + | ||
| 288 | + (async () => { | ||
| 289 | + // Check Symbol.asyncDispose implicitly | ||
| 290 | + await using duplex = new Duplex({ | ||
| 291 | + write(chunk, enc, cb) { cb(); }, | ||
| 292 | + read() {}, | ||
| 293 | + }); | ||
| 294 | + duplex.on('error', common.mustCall(function(e) { | ||
| 295 | + assert.strictEqual(e.name, 'AbortError'); | ||
| 296 | + assert.strictEqual(this.destroyed, true); | ||
| 297 | + assert.strictEqual(this.errored.name, 'AbortError'); | ||
| 298 | + })); | ||
| 299 | + duplex.on('close', common.mustCall()); | ||
| 300 | + })().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,3 +21,18 @@ const assert = require('assert'); | |||
| 21 | 21 | assert.strictEqual(read.destroyed, true); | |
| 22 | 22 | })); | |
| 23 | 23 | } | |
| 24 | + | ||
| 25 | + (async () => { | ||
| 26 | + await using read = new Readable({ | ||
| 27 | + read() {} | ||
| 28 | + }); | ||
| 29 | + read.resume(); | ||
| 30 | + | ||
| 31 | + read.on('end', common.mustNotCall('no end event')); | ||
| 32 | + read.on('close', common.mustCall()); | ||
| 33 | + read.on('error', common.mustCall(function(err) { | ||
| 34 | + assert.strictEqual(err.name, 'AbortError'); | ||
| 35 | + assert.strictEqual(this.errored.name, 'AbortError'); | ||
| 36 | + assert.strictEqual(this.destroyed, true); | ||
| 37 | + })); | ||
| 38 | + })().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -152,3 +152,15 @@ const assert = require('assert'); | |||
| 152 | 152 | transform.on('close', common.mustCall()); | |
| 153 | 153 | transform[Symbol.asyncDispose]().then(common.mustCall()); | |
| 154 | 154 | } | |
| 155 | + | ||
| 156 | + (async () => { | ||
| 157 | + await using transform = new Transform({ | ||
| 158 | + transform(chunk, enc, cb) {} | ||
| 159 | + }); | ||
| 160 | + transform.on('error', common.mustCall(function(err) { | ||
| 161 | + assert.strictEqual(err.name, 'AbortError'); | ||
| 162 | + assert.strictEqual(this.destroyed, true); | ||
| 163 | + assert.strictEqual(this.errored.name, 'AbortError'); | ||
| 164 | + })); | ||
| 165 | + transform.on('close', common.mustCall()); | ||
| 166 | + })().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -499,3 +499,17 @@ const assert = require('assert'); | |||
| 499 | 499 | })); | |
| 500 | 500 | write[Symbol.asyncDispose]().then(common.mustCall()); | |
| 501 | 501 | } | |
| 502 | + | ||
| 503 | + (async () => { | ||
| 504 | + await using write = new Writable({ | ||
| 505 | + write(chunk, enc, cb) { cb(); } | ||
| 506 | + }); | ||
| 507 | + | ||
| 508 | + write.on('error', common.mustCall(function(e) { | ||
| 509 | + assert.strictEqual(e.name, 'AbortError'); | ||
| 510 | + assert.strictEqual(this.destroyed, true); | ||
| 511 | + assert.strictEqual(this.errored.name, 'AbortError'); | ||
| 512 | + })); | ||
| 513 | + write.on('close', common.mustCall()); | ||
| 514 | + write.on('finish', common.mustNotCall('no finish event')); | ||
| 515 | + })().then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments