From 398ebaf929e396b48fd5ae6d2e2b9de5633ef509 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 4 Jan 2018 02:08:49 +0200 Subject: [PATCH 1/3] doc: compact eslint directives in common/README --- test/common/README.md | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index 3a71aed858eb7f..e819914b57ee62 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -557,10 +557,7 @@ implementation with tests from The http2.js module provides a handful of utilities for creating mock HTTP/2 frames for testing of HTTP/2 endpoints - - - - + ```js const http2 = require('../common/http2'); ``` @@ -570,10 +567,7 @@ const http2 = require('../common/http2'); The `http2.Frame` is a base class that creates a `Buffer` containing a serialized HTTP/2 frame header. - - - - + ```js // length is a 24-bit unsigned integer // type is an 8-bit unsigned integer identifying the frame type @@ -592,10 +586,7 @@ The serialized `Buffer` may be retrieved using the `frame.data` property. The `http2.DataFrame` is a subclass of `http2.Frame` that serializes a `DATA` frame. - - - - + ```js // id is the 32-bit stream identifier // payload is a Buffer containing the DATA payload @@ -612,10 +603,7 @@ socket.write(frame.data); The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a `HEADERS` frame. - - - - + ```js // id is the 32-bit stream identifier // payload is a Buffer containing the HEADERS payload (see either @@ -634,10 +622,7 @@ socket.write(frame.data); The `http2.SettingsFrame` is a subclass of `http2.Frame` that serializes an empty `SETTINGS` frame. - - - - + ```js // ack is a boolean indicating whether or not to set the ACK flag. const frame = new http2.SettingsFrame(ack); @@ -650,10 +635,7 @@ socket.write(frame.data); Set to a `Buffer` instance that contains a minimal set of serialized HTTP/2 request headers to be used as the payload of a `http2.HeadersFrame`. - - - - + ```js const frame = new http2.HeadersFrame(1, http2.kFakeRequestHeaders, 0, true); @@ -665,10 +647,7 @@ socket.write(frame.data); Set to a `Buffer` instance that contains a minimal set of serialized HTTP/2 response headers to be used as the payload a `http2.HeadersFrame`. - - - - + ```js const frame = new http2.HeadersFrame(1, http2.kFakeResponseHeaders, 0, true); @@ -680,10 +659,7 @@ socket.write(frame.data); Set to a `Buffer` containing the preamble bytes an HTTP/2 client must send upon initial establishment of a connection. - - - - + ```js socket.write(http2.kClientMagic); ``` From f1dfe1beabb80c95e609e2482e230f26dae869ca Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 4 Jan 2018 02:18:31 +0200 Subject: [PATCH 2/3] doc: fix code nits in common/README 1. Sync comments and code 2. Fix typos --- test/common/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index e819914b57ee62..de4844658c2c21 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -593,7 +593,7 @@ frame. // padlen is an 8-bit integer giving the number of padding bytes to include // final is a boolean indicating whether the End-of-stream flag should be set, // defaults to false. -const data = new http2.DataFrame(id, payload, padlen, final); +const frame = new http2.DataFrame(id, payload, padlen, final); socket.write(frame.data); ``` @@ -611,8 +611,7 @@ The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a // padlen is an 8-bit integer giving the number of padding bytes to include // final is a boolean indicating whether the End-of-stream flag should be set, // defaults to false. -const data = new http2.HeadersFrame(id, http2.kFakeRequestHeaders, - padlen, final); +const frame = new http2.HeadersFrame(id, payload, padlen, final); socket.write(frame.data); ``` From d65c3ea37762bce9ecf74e10fc98054fe79bb8d6 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 4 Jan 2018 02:37:39 +0200 Subject: [PATCH 3/3] doc: re-alphabetise sections in common/README.md --- test/common/README.md | 88 +++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index de4844658c2c21..b3852dc2d6b01e 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -10,9 +10,9 @@ This directory contains modules used to test the Node.js implementation. * [DNS module](#dns-module) * [Duplex pair helper](#duplex-pair-helper) * [Fixtures module](#fixtures-module) +* [HTTP2 module](#http2-module) * [Internet module](#internet-module) * [WPT module](#wpt-module) -* [HTTP2 module](#http2-module) ## Benchmark Module @@ -509,49 +509,6 @@ Returns the result of Returns the result of `fs.readFileSync(path.join(fixtures.fixturesDir, 'keys', arg), 'enc')`. -## Internet Module - -The `common/internet` module provides utilities for working with -internet-related tests. - -### internet.addresses - -* [<Object>] - * `INET_HOST` [<String>] A generic host that has registered common - DNS records, supports both IPv4 and IPv6, and provides basic HTTP/HTTPS - services - * `INET4_HOST` [<String>] A host that provides IPv4 services - * `INET6_HOST` [<String>] A host that provides IPv6 services - * `INET4_IP` [<String>] An accessible IPv4 IP, defaults to the - Google Public DNS IPv4 address - * `INET6_IP` [<String>] An accessible IPv6 IP, defaults to the - Google Public DNS IPv6 address - * `INVALID_HOST` [<String>] An invalid host that cannot be resolved - * `MX_HOST` [<String>] A host with MX records registered - * `SRV_HOST` [<String>] A host with SRV records registered - * `PTR_HOST` [<String>] A host with PTR records registered - * `NAPTR_HOST` [<String>] A host with NAPTR records registered - * `SOA_HOST` [<String>] A host with SOA records registered - * `CNAME_HOST` [<String>] A host with CNAME records registered - * `NS_HOST` [<String>] A host with NS records registered - * `TXT_HOST` [<String>] A host with TXT records registered - * `DNS4_SERVER` [<String>] An accessible IPv4 DNS server - * `DNS6_SERVER` [<String>] An accessible IPv6 DNS server - -A set of addresses for internet-related tests. All properties are configurable -via `NODE_TEST_*` environment variables. For example, to configure -`internet.addresses.INET_HOST`, set the environment -vairable `NODE_TEST_INET_HOST` to a specified host. - -## WPT Module - -The wpt.js module is a port of parts of -[W3C testharness.js](https://github.com/w3c/testharness.js) for testing the -Node.js -[WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api) -implementation with tests from -[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests). - ## HTTP/2 Module The http2.js module provides a handful of utilities for creating mock HTTP/2 @@ -663,6 +620,49 @@ upon initial establishment of a connection. socket.write(http2.kClientMagic); ``` +## Internet Module + +The `common/internet` module provides utilities for working with +internet-related tests. + +### internet.addresses + +* [<Object>] + * `INET_HOST` [<String>] A generic host that has registered common + DNS records, supports both IPv4 and IPv6, and provides basic HTTP/HTTPS + services + * `INET4_HOST` [<String>] A host that provides IPv4 services + * `INET6_HOST` [<String>] A host that provides IPv6 services + * `INET4_IP` [<String>] An accessible IPv4 IP, defaults to the + Google Public DNS IPv4 address + * `INET6_IP` [<String>] An accessible IPv6 IP, defaults to the + Google Public DNS IPv6 address + * `INVALID_HOST` [<String>] An invalid host that cannot be resolved + * `MX_HOST` [<String>] A host with MX records registered + * `SRV_HOST` [<String>] A host with SRV records registered + * `PTR_HOST` [<String>] A host with PTR records registered + * `NAPTR_HOST` [<String>] A host with NAPTR records registered + * `SOA_HOST` [<String>] A host with SOA records registered + * `CNAME_HOST` [<String>] A host with CNAME records registered + * `NS_HOST` [<String>] A host with NS records registered + * `TXT_HOST` [<String>] A host with TXT records registered + * `DNS4_SERVER` [<String>] An accessible IPv4 DNS server + * `DNS6_SERVER` [<String>] An accessible IPv6 DNS server + +A set of addresses for internet-related tests. All properties are configurable +via `NODE_TEST_*` environment variables. For example, to configure +`internet.addresses.INET_HOST`, set the environment +vairable `NODE_TEST_INET_HOST` to a specified host. + +## WPT Module + +The wpt.js module is a port of parts of +[W3C testharness.js](https://github.com/w3c/testharness.js) for testing the +Node.js +[WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api) +implementation with tests from +[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests). + [<Array>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array [<ArrayBufferView[]>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView