| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1f00359 commit 3ed0204
27 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ function callbackOnly(err) { | |||
| 28 | 28 | } | |
| 29 | 29 | ||
| 30 | 30 | function onEvent(err) { | |
| 31 | - assert.fail(null, null, 'Error should not be emitted if there is callback'); | ||
| 31 | + common.fail('Error should not be emitted if there is callback'); | ||
| 32 | 32 | } | |
| 33 | 33 | ||
| 34 | 34 | function onError(err) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - require('../common'); | ||
| 3 | + const common = require('../common'); | ||
| 4 | 4 | var assert = require('assert'); | |
| 5 | 5 | ||
| 6 | 6 | var EventEmitter = require('events').EventEmitter; | |
@@ -14,12 +14,12 @@ assert(fl.length === 0); | |||
| 14 | 14 | assert(!(e._events instanceof Object)); | |
| 15 | 15 | assert.deepStrictEqual(Object.keys(e._events), []); | |
| 16 | 16 | ||
| 17 | - e.on('foo', assert.fail); | ||
| 17 | + e.on('foo', common.fail); | ||
| 18 | 18 | fl = e.listeners('foo'); | |
| 19 | - assert(e._events.foo === assert.fail); | ||
| 19 | + assert(e._events.foo === common.fail); | ||
| 20 | 20 | assert(Array.isArray(fl)); | |
| 21 | 21 | assert(fl.length === 1); | |
| 22 | - assert(fl[0] === assert.fail); | ||
| 22 | + assert(fl[0] === common.fail); | ||
| 23 | 23 | ||
| 24 | 24 | e.listeners('bar'); | |
| 25 | 25 | ||
@@ -28,12 +28,12 @@ fl = e.listeners('foo'); | |||
| 28 | 28 | ||
| 29 | 29 | assert(Array.isArray(e._events.foo)); | |
| 30 | 30 | assert(e._events.foo.length === 2); | |
| 31 | - assert(e._events.foo[0] === assert.fail); | ||
| 31 | + assert(e._events.foo[0] === common.fail); | ||
| 32 | 32 | assert(e._events.foo[1] === assert.ok); | |
| 33 | 33 | ||
| 34 | 34 | assert(Array.isArray(fl)); | |
| 35 | 35 | assert(fl.length === 2); | |
| 36 | - assert(fl[0] === assert.fail); | ||
| 36 | + assert(fl[0] === common.fail); | ||
| 37 | 37 | assert(fl[1] === assert.ok); | |
| 38 | 38 | ||
| 39 | 39 | console.log('ok'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - require('../common'); | ||
| 2 | + const common = require('../common'); | ||
| 3 | 3 | var assert = require('assert'); | |
| 4 | 4 | var events = require('events'); | |
| 5 | 5 | ||
@@ -16,7 +16,7 @@ e.emit('hello', 'a', 'b'); | |||
| 16 | 16 | e.emit('hello', 'a', 'b'); | |
| 17 | 17 | ||
| 18 | 18 | var remove = function() { | |
| 19 | - assert.fail(1, 0, 'once->foo should not be emitted', '!'); | ||
| 19 | + common.fail('once->foo should not be emitted'); | ||
| 20 | 20 | }; | |
| 21 | 21 | ||
| 22 | 22 | e.once('foo', remove); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ server.listen(0, () => { | |||
| 18 | 18 | // both a Content-Length header and a Transfer-Encoding: chunked | |
| 19 | 19 | // header, which is a violation of the HTTP spec. | |
| 20 | 20 | const req = http.get({port: server.address().port}, (res) => { | |
| 21 | - assert.fail(null, null, 'callback should not be called'); | ||
| 21 | + common.fail('callback should not be called'); | ||
| 22 | 22 | }); | |
| 23 | 23 | req.on('error', common.mustCall((err) => { | |
| 24 | 24 | assert(/^Parse Error/.test(err.message)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ server.listen(0, () => { | |||
| 17 | 17 | // The callback should not be called because the server is sending a | |
| 18 | 18 | // header field that ends only in \r with no following \n | |
| 19 | 19 | const req = http.get({port: server.address().port}, (res) => { | |
| 20 | - assert.fail(null, null, 'callback should not be called'); | ||
| 20 | + common.fail('callback should not be called'); | ||
| 21 | 21 | }); | |
| 22 | 22 | req.on('error', common.mustCall((err) => { | |
| 23 | 23 | assert(/^Parse Error/.test(err.message)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ const server = http.createServer(common.mustCall(function(req, res) { | |||
| 21 | 21 | res.resume(); | |
| 22 | 22 | fn = common.mustCall(createConnectionError); | |
| 23 | 23 | http.get({ createConnection: fn }, function(res) { | |
| 24 | - assert.fail(null, null, 'Unexpected response callback'); | ||
| 24 | + common.fail('Unexpected response callback'); | ||
| 25 | 25 | }).on('error', common.mustCall(function(err) { | |
| 26 | 26 | assert.equal(err.message, 'Could not create socket'); | |
| 27 | 27 | server.close(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,8 +23,7 @@ server.listen(0, () => { | |||
| 23 | 23 | // Send two content-length header values. | |
| 24 | 24 | headers: {'Content-Length': [1, 2]}}, | |
| 25 | 25 | (res) => { | |
| 26 | - assert.fail(null, null, 'an error should have occurred'); | ||
| 27 | - server.close(); | ||
| 26 | + common.fail('an error should have occurred'); | ||
| 28 | 27 | } | |
| 29 | 28 | ); | |
| 30 | 29 | req.on('error', common.mustCall(() => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - require('../common'); | ||
| 2 | + const common = require('../common'); | ||
| 3 | 3 | var assert = require('assert'); | |
| 4 | 4 | var http = require('http'); | |
| 5 | 5 | ||
@@ -24,7 +24,7 @@ server.listen(0, '127.0.0.1', function() { | |||
| 24 | 24 | method: 'GET', | |
| 25 | 25 | localAddress: invalidLocalAddress | |
| 26 | 26 | }, function(res) { | |
| 27 | - assert.fail(null, null, 'unexpectedly got response from server'); | ||
| 27 | + common.fail('unexpectedly got response from server'); | ||
| 28 | 28 | }).on('error', function(e) { | |
| 29 | 29 | console.log('client got error: ' + e.message); | |
| 30 | 30 | gotError = true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ const server = http.createServer((req, res) => { | |||
| 19 | 19 | res.writeHead(200, {'content-length': [1, 2]}); | |
| 20 | 20 | break; | |
| 21 | 21 | default: | |
| 22 | - assert.fail(null, null, 'should never get here'); | ||
| 22 | + common.fail('should never get here'); | ||
| 23 | 23 | } | |
| 24 | 24 | res.end('ok'); | |
| 25 | 25 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ const server = http.createServer((req, res) => { | |||
| 38 | 38 | })); | |
| 39 | 39 | break; | |
| 40 | 40 | default: | |
| 41 | - assert.fail(null, null, 'should not get to here.'); | ||
| 41 | + common.fail('should not get to here.'); | ||
| 42 | 42 | } | |
| 43 | 43 | if (count === 3) | |
| 44 | 44 | server.close(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments