| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8a0ecf4 commit a62df1b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,27 +21,20 @@ | |||
| 21 | 21 | ||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | const common = require('../common'); | |
| 24 | - const assert = require('assert'); | ||
| 25 | 24 | ||
| 25 | + const assert = require('assert'); | ||
| 26 | 26 | const net = require('net'); | |
| 27 | 27 | ||
| 28 | 28 | const host = '*'.repeat(256); | |
| 29 | + const errCode = common.isOpenBSD ? 'EAI_FAIL' : 'ENOTFOUND'; | ||
| 29 | 30 | ||
| 30 | - let errCode = 'ENOTFOUND'; | ||
| 31 | - if (common.isOpenBSD) | ||
| 32 | - errCode = 'EAI_FAIL'; | ||
| 33 | - | ||
| 34 | - function do_not_call() { | ||
| 35 | - throw new Error('This function should not have been called.'); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - const socket = net.connect(42, host, do_not_call); | ||
| 31 | + const socket = net.connect(42, host, common.mustNotCall()); | ||
| 39 | 32 | socket.on('error', common.mustCall(function(err) { | |
| 40 | 33 | assert.strictEqual(err.code, errCode); | |
| 41 | 34 | })); | |
| 42 | - socket.on('lookup', function(err, ip, type) { | ||
| 35 | + socket.on('lookup', common.mustCall(function(err, ip, type) { | ||
| 43 | 36 | assert(err instanceof Error); | |
| 44 | 37 | assert.strictEqual(err.code, errCode); | |
| 45 | 38 | assert.strictEqual(ip, undefined); | |
| 46 | 39 | assert.strictEqual(type, undefined); | |
| 47 | - }); | ||
| 40 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments