| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 56bf6c1 commit 178fe21
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ const { | |||
| 6 | 6 | createHistogram, | |
| 7 | 7 | monitorEventLoopDelay, | |
| 8 | 8 | } = require('perf_hooks'); | |
| 9 | + const { inspect } = require('util'); | ||
| 9 | 10 | ||
| 10 | 11 | { | |
| 11 | 12 | const h = createHistogram(); | |
@@ -67,3 +68,18 @@ const { | |||
| 67 | 68 | }); | |
| 68 | 69 | setTimeout(() => mc.port2.postMessage(e), 100); | |
| 69 | 70 | } | |
| 71 | + | ||
| 72 | + { | ||
| 73 | + const h = createHistogram(); | ||
| 74 | + assert(inspect(h, { depth: null }).startsWith('Histogram')); | ||
| 75 | + assert.strictEqual(inspect(h, { depth: -1 }), '[RecordableHistogram]'); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + { | ||
| 79 | + // Tests that RecordableHistogram is impossible to construct manually | ||
| 80 | + const h = createHistogram(); | ||
| 81 | + assert.throws( | ||
| 82 | + () => new h.constructor(), | ||
| 83 | + /^TypeError: illegal constructor$/ | ||
| 84 | + ); | ||
| 85 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments