mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
node: sync test-net-connect-no-arg.js (#20608)
This commit is contained in:
@@ -1747,7 +1747,7 @@ JSC_DEFINE_HOST_FUNCTION(Bun::jsFunctionMakeErrorWithCode, (JSC::JSGlobalObject
|
||||
}
|
||||
case 2: {
|
||||
JSValue arg0 = callFrame->argument(1);
|
||||
// ["foo", "bar", "baz"] -> 'The "foo", "bar", or "baz" argument must be specified'
|
||||
// ["foo", "bar", "baz"] -> 'The "foo" or "bar" or "baz" argument must be specified'
|
||||
if (auto* arr = jsDynamicCast<JSC::JSArray*>(arg0)) {
|
||||
ASSERT(arr->length() > 0);
|
||||
WTF::StringBuilder builder;
|
||||
@@ -1755,7 +1755,7 @@ JSC_DEFINE_HOST_FUNCTION(Bun::jsFunctionMakeErrorWithCode, (JSC::JSGlobalObject
|
||||
for (unsigned i = 0, length = arr->length(); i < length; i++) {
|
||||
JSValue index = arr->getIndex(globalObject, i);
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
if (i == length - 1) builder.append("or "_s);
|
||||
if (i > 0) builder.append("or "_s);
|
||||
builder.append('"');
|
||||
auto* jsString = index.toString(globalObject);
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
@@ -1763,7 +1763,6 @@ JSC_DEFINE_HOST_FUNCTION(Bun::jsFunctionMakeErrorWithCode, (JSC::JSGlobalObject
|
||||
RETURN_IF_EXCEPTION(scope, {});
|
||||
builder.append(str);
|
||||
builder.append('"');
|
||||
if (i != length - 1) builder.append(',');
|
||||
builder.append(' ');
|
||||
}
|
||||
builder.append("argument must be specified"_s);
|
||||
|
||||
@@ -5,31 +5,31 @@ const assert = require('assert');
|
||||
const net = require('net');
|
||||
|
||||
// Tests that net.connect() called without arguments throws ERR_MISSING_ARGS.
|
||||
const message = 'The "options", "port", or "path" argument must be specified';
|
||||
|
||||
assert.throws(() => {
|
||||
net.connect();
|
||||
}, {
|
||||
code: 'ERR_MISSING_ARGS',
|
||||
message,
|
||||
message: 'The "options" or "port" or "path" argument must be specified',
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
new net.Socket().connect();
|
||||
}, {
|
||||
code: 'ERR_MISSING_ARGS',
|
||||
message,
|
||||
message: 'The "options" or "port" or "path" argument must be specified',
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
net.connect({});
|
||||
}, {
|
||||
code: 'ERR_MISSING_ARGS',
|
||||
message,
|
||||
message: 'The "options" or "port" or "path" argument must be specified',
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
new net.Socket().connect({});
|
||||
}, {
|
||||
code: 'ERR_MISSING_ARGS',
|
||||
message,
|
||||
message: 'The "options" or "port" or "path" argument must be specified',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user