| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a27098d commit 96924ed
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + require('../common'); | ||
| 3 | + | ||
| 4 | + // lib/buffer.js defines Buffer.prototype.inspect() to override how buffers are | ||
| 5 | + // presented by util.inspect(). | ||
| 6 | + | ||
| 7 | + const assert = require('assert'); | ||
| 8 | + const util = require('util'); | ||
| 9 | + | ||
| 10 | + { | ||
| 11 | + const buf = Buffer.from('fhqwhgads'); | ||
| 12 | + assert.strictEqual(util.inspect(buf), '<Buffer 66 68 71 77 68 67 61 64 73>'); | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + { | ||
| 16 | + const buf = Buffer.from(''); | ||
| 17 | + assert.strictEqual(util.inspect(buf), '<Buffer >'); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + { | ||
| 21 | + const buf = Buffer.from('x'.repeat(51)); | ||
| 22 | + assert.ok(/^<Buffer (78 ){50}\.\.\. >$/.test(util.inspect(buf))); | ||
| 23 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments