Skip to content

Commit 45c3368

Browse files
committed
benchmark: cover rejected input in socket address parse
The parse benchmark only measured inputs that parse successfully, so the rejection paths were unmeasured. Add a group covering the four ways the parser bails: a non-address host and a legacy hex form that only uv_inet_pton rejects, an out of range port, and an unterminated IPv6 address that never reaches uv_ip6_addr. Assisted-by: Claude Opus 5 Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
1 parent 7fd8d95 commit 45c3368

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎benchmark/net/net-socketaddress-parse.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ const inputs = {
2424
'[2001:db8::1]:8080',
2525
'[::ffff:127.0.0.1]:65535',
2626
],
27+
'invalid': [
28+
'localhost',
29+
'0x7f.1',
30+
'127.0.0.1:99999',
31+
'[::1',
32+
],
2733
};
2834

2935
const bench = common.createBenchmark(main, {

0 commit comments

Comments
 (0)