diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/internet/test-dns-idna2008.js | 33 | ||||
-rw-r--r-- | test/parallel/test-bootstrap-modules.js | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/test/internet/test-dns-idna2008.js b/test/internet/test-dns-idna2008.js new file mode 100644 index 0000000000..ebabe322f0 --- /dev/null +++ b/test/internet/test-dns-idna2008.js @@ -0,0 +1,33 @@ +'use strict'; + +// Verify that non-ASCII hostnames are handled correctly as IDNA 2008. +// +// * Tests will fail with NXDOMAIN when UTF-8 leaks through to a getaddrinfo() +// that doesn't support IDNA at all. +// +// * "straße.de" will resolve to the wrong address when the resolver supports +// only IDNA 2003 (e.g., glibc until 2.28) because it encodes it wrong. + +const { mustCall } = require('../common'); +const assert = require('assert'); +const dns = require('dns'); + +const [host, expectedAddress] = ['straße.de', '81.169.145.78']; + +dns.lookup(host, mustCall((err, address) => { + assert.ifError(err); + assert.strictEqual(address, expectedAddress); +})); + +dns.promises.lookup(host).then(mustCall(({ address }) => { + assert.strictEqual(address, expectedAddress); +})); + +dns.resolve4(host, mustCall((err, addresses) => { + assert.ifError(err); + assert.deepStrictEqual(addresses, [expectedAddress]); +})); + +new dns.promises.Resolver().resolve4(host).then(mustCall((addresses) => { + assert.deepStrictEqual(addresses, [expectedAddress]); +})); diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 87210ec344..73e47ed9d5 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -10,7 +10,7 @@ const assert = require('assert'); const isMainThread = common.isMainThread; const kCoverageModuleCount = process.env.NODE_V8_COVERAGE ? 1 : 0; -const kMaxModuleCount = (isMainThread ? 63 : 85) + kCoverageModuleCount; +const kMaxModuleCount = (isMainThread ? 64 : 86) + kCoverageModuleCount; assert(list.length <= kMaxModuleCount, `Total length: ${list.length}\n` + list.join('\n') |