| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -205,7 +205,7 @@ export default [ | |||
| 205 | 205 | Array.from({ length: 13 }, (_, i) => String.fromCharCode(0x61 + i, 42)).join(',') | |
| 206 | 206 | },n*,${ | |
| 207 | 207 | // 0x61 is code for 'a', this generates a string enumerating latin letters: 'z*,y*,…' | |
| 208 | - Array.from({ length: 5 }, (_, i) => String.fromCharCode(0x61 + 25 - i, 42)).join(',') | ||
| 208 | + Array.from({ length: 7 }, (_, i) => String.fromCharCode(0x61 + 25 - i, 42)).join(',') | ||
| 209 | 209 | }}.{js,mjs,cjs}`, | |
| 210 | 210 | ], | |
| 211 | 211 | rules: { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | // Flags: --expose-internals | |
| 2 | 2 | 'use strict'; | |
| 3 | - require('../common'); | ||
| 3 | + const common = require('../common'); | ||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const { internalBinding } = require('internal/test/binding'); | |
| 6 | 6 | const { | |
@@ -17,7 +17,7 @@ function makeConnection() { | |||
| 17 | 17 | const err = client.connect(req, '127.0.0.1', this.address().port); | |
| 18 | 18 | assert.strictEqual(err, 0); | |
| 19 | 19 | ||
| 20 | - req.oncomplete = function(status, client_, req_, readable, writable) { | ||
| 20 | + req.oncomplete = common.mustCall((status, client_, req_, readable, writable) => { | ||
| 21 | 21 | assert.strictEqual(status, 0); | |
| 22 | 22 | assert.strictEqual(client_, client); | |
| 23 | 23 | assert.strictEqual(req_, req); | |
@@ -28,14 +28,14 @@ function makeConnection() { | |||
| 28 | 28 | const err = client.shutdown(shutdownReq); | |
| 29 | 29 | assert.strictEqual(err, 0); | |
| 30 | 30 | ||
| 31 | - shutdownReq.oncomplete = function(status, client_, error) { | ||
| 31 | + shutdownReq.oncomplete = common.mustCall((status, client_, error) => { | ||
| 32 | 32 | assert.strictEqual(status, 0); | |
| 33 | 33 | assert.strictEqual(client_, client); | |
| 34 | 34 | assert.strictEqual(error, undefined); | |
| 35 | 35 | shutdownCount++; | |
| 36 | 36 | client.close(); | |
| 37 | - }; | ||
| 38 | - }; | ||
| 37 | + }); | ||
| 38 | + }); | ||
| 39 | 39 | } | |
| 40 | 40 | ||
| 41 | 41 | let connectCount = 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ server.getsockname(port); | |||
| 24 | 24 | ||
| 25 | 25 | server.listen(128); | |
| 26 | 26 | ||
| 27 | - server.onconnection = (err, client) => { | ||
| 27 | + server.onconnection = common.mustCall((err, client) => { | ||
| 28 | 28 | assert.strictEqual(client.writeQueueSize, 0); | |
| 29 | 29 | console.log('got connection'); | |
| 30 | 30 | ||
@@ -82,7 +82,7 @@ server.onconnection = (err, client) => { | |||
| 82 | 82 | maybeCloseClient(); | |
| 83 | 83 | } | |
| 84 | 84 | }, 2); | |
| 85 | - }; | ||
| 85 | + }); | ||
| 86 | 86 | ||
| 87 | 87 | const net = require('net'); | |
| 88 | 88 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,7 @@ process.once('uncaughtException', common.mustCall((err, errorOrigin) => { | |||
| 31 | 31 | ||
| 32 | 32 | const d1 = domain.create(); | |
| 33 | 33 | d1.once('error', common.expectsError(errObj)); | |
| 34 | - d1.once('error', () => assert.strictEqual(stage, 0)); | ||
| 34 | + d1.once('error', common.mustCall(() => assert.strictEqual(stage, 0))); | ||
| 35 | 35 | ||
| 36 | 36 | const run = common.mustCall((callStage) => { | |
| 37 | 37 | assert(callStage >= stage); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -196,7 +196,7 @@ const { setInterval } = timerPromises; | |||
| 196 | 196 | const { signal } = controller; | |
| 197 | 197 | const delay = 10; | |
| 198 | 198 | let totalIterations = 0; | |
| 199 | - const timeoutLoop = runInterval(async (iterationNumber) => { | ||
| 199 | + const timeoutLoop = runInterval(common.mustCallAtLeast(async (iterationNumber) => { | ||
| 200 | 200 | await setPromiseTimeout(delay * 4); | |
| 201 | 201 | if (iterationNumber <= 2) { | |
| 202 | 202 | assert.strictEqual(signal.aborted, false); | |
@@ -210,7 +210,7 @@ const { setInterval } = timerPromises; | |||
| 210 | 210 | if (iterationNumber > totalIterations) { | |
| 211 | 211 | totalIterations = iterationNumber; | |
| 212 | 212 | } | |
| 213 | - }, delay, signal); | ||
| 213 | + }, 0), delay, signal); | ||
| 214 | 214 | ||
| 215 | 215 | timeoutLoop.catch(common.mustCall(() => { | |
| 216 | 216 | assert.ok(totalIterations >= 3, `iterations was ${totalIterations} < 3`); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,11 +4,7 @@ const common = require('../common'); | |||
| 4 | 4 | ||
| 5 | 5 | const { scheduler } = require('timers/promises'); | |
| 6 | 6 | const { setTimeout } = require('timers'); | |
| 7 | - const { | ||
| 8 | - strictEqual, | ||
| 9 | - rejects, | ||
| 10 | - throws, | ||
| 11 | - } = require('assert'); | ||
| 7 | + const assert = require('assert'); | ||
| 12 | 8 | ||
| 13 | 9 | async function testYield() { | |
| 14 | 10 | await scheduler.yield(); | |
@@ -23,7 +19,7 @@ async function testWait() { | |||
| 23 | 19 | let value = 0; | |
| 24 | 20 | setTimeout(() => value++, 10); | |
| 25 | 21 | await scheduler.wait(15); | |
| 26 | - strictEqual(value, 1); | ||
| 22 | + assert.strictEqual(value, 1); | ||
| 27 | 23 | } | |
| 28 | 24 | ||
| 29 | 25 | testWait().then(common.mustCall()); | |
@@ -32,7 +28,7 @@ async function testCancelableWait1() { | |||
| 32 | 28 | const ac = new AbortController(); | |
| 33 | 29 | const wait = scheduler.wait(1e6, { signal: ac.signal }); | |
| 34 | 30 | ac.abort(); | |
| 35 | - await rejects(wait, { | ||
| 31 | + await assert.rejects(wait, { | ||
| 36 | 32 | code: 'ABORT_ERR', | |
| 37 | 33 | message: 'The operation was aborted', | |
| 38 | 34 | }); | |
@@ -42,14 +38,14 @@ testCancelableWait1().then(common.mustCall()); | |||
| 42 | 38 | ||
| 43 | 39 | async function testCancelableWait2() { | |
| 44 | 40 | const wait = scheduler.wait(10000, { signal: AbortSignal.abort() }); | |
| 45 | - await rejects(wait, { | ||
| 41 | + await assert.rejects(wait, { | ||
| 46 | 42 | code: 'ABORT_ERR', | |
| 47 | 43 | message: 'The operation was aborted', | |
| 48 | 44 | }); | |
| 49 | 45 | } | |
| 50 | 46 | ||
| 51 | 47 | testCancelableWait2().then(common.mustCall()); | |
| 52 | 48 | ||
| 53 | - throws(() => new scheduler.constructor(), { | ||
| 49 | + assert.throws(() => new scheduler.constructor(), { | ||
| 54 | 50 | code: 'ERR_ILLEGAL_CONSTRUCTOR', | |
| 55 | 51 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | const common = require('../common'); | |
| 6 | 6 | ||
| 7 | - const { strictEqual, throws } = require('assert'); | ||
| 7 | + const assert = require('assert'); | ||
| 8 | 8 | const { setUnrefTimeout } = require('internal/timers'); | |
| 9 | 9 | ||
| 10 | 10 | // Schedule the unrefed cases first so that the later case keeps the event loop | |
@@ -24,16 +24,16 @@ const { setUnrefTimeout } = require('internal/timers'); | |||
| 24 | 24 | // This relies on implicit timers handle sorting within libuv. | |
| 25 | 25 | ||
| 26 | 26 | setTimeout(common.mustCall(() => { | |
| 27 | - strictEqual(called, false, 'unref()\'d timer returned before check'); | ||
| 27 | + assert.strictEqual(called, false); | ||
| 28 | 28 | }), 1); | |
| 29 | 29 | ||
| 30 | - strictEqual(timer.refresh(), timer); | ||
| 30 | + assert.strictEqual(timer.refresh(), timer); | ||
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | 33 | // Should throw with non-functions | |
| 34 | 34 | { | |
| 35 | 35 | [null, true, false, 0, 1, NaN, '', 'foo', {}, Symbol()].forEach((cb) => { | |
| 36 | - throws( | ||
| 36 | + assert.throws( | ||
| 37 | 37 | () => setUnrefTimeout(cb), | |
| 38 | 38 | { | |
| 39 | 39 | code: 'ERR_INVALID_ARG_TYPE', | |
@@ -50,10 +50,10 @@ const { setUnrefTimeout } = require('internal/timers'); | |||
| 50 | 50 | }), 1); | |
| 51 | 51 | ||
| 52 | 52 | setUnrefTimeout(common.mustCall(() => { | |
| 53 | - strictEqual(called, false, 'unref pooled timer returned before check'); | ||
| 53 | + assert.strictEqual(called, false); | ||
| 54 | 54 | }), 1); | |
| 55 | 55 | ||
| 56 | - strictEqual(timer.refresh(), timer); | ||
| 56 | + assert.strictEqual(timer.refresh(), timer); | ||
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | 59 | // regular timer | |
@@ -64,10 +64,10 @@ const { setUnrefTimeout } = require('internal/timers'); | |||
| 64 | 64 | }), 1); | |
| 65 | 65 | ||
| 66 | 66 | setTimeout(common.mustCall(() => { | |
| 67 | - strictEqual(called, false, 'pooled timer returned before check'); | ||
| 67 | + assert.strictEqual(called, false); | ||
| 68 | 68 | }), 1); | |
| 69 | 69 | ||
| 70 | - strictEqual(timer.refresh(), timer); | ||
| 70 | + assert.strictEqual(timer.refresh(), timer); | ||
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | 73 | // regular timer | |
@@ -78,7 +78,7 @@ const { setUnrefTimeout } = require('internal/timers'); | |||
| 78 | 78 | called = true; | |
| 79 | 79 | process.nextTick(common.mustCall(() => { | |
| 80 | 80 | timer.refresh(); | |
| 81 | - strictEqual(timer.hasRef(), true); | ||
| 81 | + assert.strictEqual(timer.hasRef(), true); | ||
| 82 | 82 | })); | |
| 83 | 83 | } | |
| 84 | 84 | }, 2), 1); | |
@@ -95,8 +95,8 @@ const { setUnrefTimeout } = require('internal/timers'); | |||
| 95 | 95 | }, 2), 1); | |
| 96 | 96 | ||
| 97 | 97 | setTimeout(common.mustCall(() => { | |
| 98 | - strictEqual(called, 0, 'pooled timer returned before check'); | ||
| 98 | + assert.strictEqual(called, 0); | ||
| 99 | 99 | }), 1); | |
| 100 | 100 | ||
| 101 | - strictEqual(timer.refresh(), timer); | ||
| 101 | + assert.strictEqual(timer.refresh(), timer); | ||
| 102 | 102 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,11 +9,11 @@ process.once('uncaughtException', common.mustCall((err) => { | |||
| 9 | 9 | })); | |
| 10 | 10 | ||
| 11 | 11 | let called = false; | |
| 12 | - const t = setTimeout(() => { | ||
| 12 | + const t = setTimeout(common.mustCall(() => { | ||
| 13 | 13 | assert(!called); | |
| 14 | 14 | called = true; | |
| 15 | 15 | t.ref(); | |
| 16 | 16 | throw new Error('Timeout Error'); | |
| 17 | - }, 1).unref(); | ||
| 17 | + }), 1).unref(); | ||
| 18 | 18 | ||
| 19 | 19 | setTimeout(common.mustCall(), 1); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,12 +25,12 @@ const common = require('../common'); | |||
| 25 | 25 | } | |
| 26 | 26 | ||
| 27 | 27 | { | |
| 28 | - const testInterval = (...args) => { | ||
| 28 | + const testInterval = common.mustCall((...args) => { | ||
| 29 | 29 | const fn = common.mustCall(() => { clearInterval(interval); }); | |
| 30 | 30 | fn.call = 'not a function'; | |
| 31 | 31 | fn.apply = 'also not a function'; | |
| 32 | 32 | const interval = setInterval(fn, 1, ...args); | |
| 33 | - }; | ||
| 33 | + }, 5); | ||
| 34 | 34 | ||
| 35 | 35 | testInterval(); | |
| 36 | 36 | testInterval('oneArg'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ const serverOptions = { | |||
| 22 | 22 | ||
| 23 | 23 | let connections = 0; | |
| 24 | 24 | ||
| 25 | - const server = tls.createServer(serverOptions, (c) => { | ||
| 25 | + const server = tls.createServer(serverOptions, common.mustCall((c) => { | ||
| 26 | 26 | if (++connections === 3) { | |
| 27 | 27 | server.close(); | |
| 28 | 28 | } | |
@@ -31,7 +31,7 @@ const server = tls.createServer(serverOptions, (c) => { | |||
| 31 | 31 | return; | |
| 32 | 32 | } | |
| 33 | 33 | assert.strictEqual(c.authorized, true); | |
| 34 | - }); | ||
| 34 | + }, 3)); | ||
| 35 | 35 | ||
| 36 | 36 | const secureContext = { | |
| 37 | 37 | key: loadPEM('agent1-key'), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments