diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2023-03-21 22:38:07 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 22:38:07 +0900 |
commit | aa729a42b4257b4d58bfcd0270566756c9470d08 (patch) | |
tree | ad9bcd33f812d753c62250094d416834999fb5a5 /cli/tests/node_compat/test/parallel/test-net-bytes-written-large.js | |
parent | c34e26a9d56596645ee63b19f99c09cf4aea4b37 (diff) |
chore(tools): restore node compat test setup script (#18290)
Diffstat (limited to 'cli/tests/node_compat/test/parallel/test-net-bytes-written-large.js')
-rw-r--r-- | cli/tests/node_compat/test/parallel/test-net-bytes-written-large.js | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/cli/tests/node_compat/test/parallel/test-net-bytes-written-large.js b/cli/tests/node_compat/test/parallel/test-net-bytes-written-large.js deleted file mode 100644 index 98df17dca..000000000 --- a/cli/tests/node_compat/test/parallel/test-net-bytes-written-large.js +++ /dev/null @@ -1,74 +0,0 @@ -// deno-fmt-ignore-file -// deno-lint-ignore-file - -// Copyright Joyent and Node contributors. All rights reserved. MIT license. -// Taken from Node 18.12.1 -// This file is automatically generated by "node/_tools/setup.ts". Do not modify this file manually - -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - -// Regression test for https://github.com/nodejs/node/issues/19562: -// Writing to a socket first tries to push through as much data as possible -// without blocking synchronously, and, if that is not enough, queues more -// data up for asynchronous writing. -// Check that `bytesWritten` accounts for both parts of a write. - -const N = 10000000; -{ - // Variant 1: Write a Buffer. - const server = net.createServer(common.mustCall((socket) => { - socket.end(Buffer.alloc(N), common.mustCall(() => { - assert.strictEqual(socket.bytesWritten, N); - })); - assert.strictEqual(socket.bytesWritten, N); - })).listen(0, common.mustCall(() => { - const client = net.connect(server.address().port); - client.resume(); - client.on('close', common.mustCall(() => { - assert.strictEqual(client.bytesRead, N); - server.close(); - })); - })); -} - -{ - // Variant 2: Write a string. - const server = net.createServer(common.mustCall((socket) => { - socket.end('a'.repeat(N), common.mustCall(() => { - assert.strictEqual(socket.bytesWritten, N); - })); - assert.strictEqual(socket.bytesWritten, N); - })).listen(0, common.mustCall(() => { - const client = net.connect(server.address().port); - client.resume(); - client.on('close', common.mustCall(() => { - assert.strictEqual(client.bytesRead, N); - server.close(); - })); - })); -} - -{ - // Variant 2: writev() with mixed data. - const server = net.createServer(common.mustCall((socket) => { - socket.cork(); - socket.write('a'.repeat(N)); - assert.strictEqual(socket.bytesWritten, N); - socket.write(Buffer.alloc(N)); - assert.strictEqual(socket.bytesWritten, 2 * N); - socket.end('', common.mustCall(() => { - assert.strictEqual(socket.bytesWritten, 2 * N); - })); - socket.uncork(); - })).listen(0, common.mustCall(() => { - const client = net.connect(server.address().port); - client.resume(); - client.on('close', common.mustCall(() => { - assert.strictEqual(client.bytesRead, 2 * N); - server.close(); - })); - })); -} |