-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuffers.js
111 lines (86 loc) · 4.24 KB
/
buffers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import inspect from '../lib/index.js'
import { expect } from 'chai'
describe('buffers', () => {
beforeEach(function () {
if (typeof Buffer !== 'function') {
this.skip()
}
})
it('returns `Buffer[]` for empty arrays', () => {
expect(inspect(Buffer.from(''))).to.equal('Buffer[]')
})
it('returns a populated buffer', () => {
expect(inspect(Buffer.from([2, 3, 4]))).to.equal('Buffer[ 2, 3, 4 ]')
})
describe('truncate', () => {
it('returns the full representation when truncate is over string length', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 21 })).to.equal('Buffer[ 1, 2, 3 ]')
})
it('truncates array values longer than truncate (20)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 20 })).to.equal('Buffer[ 1, 2, 3 ]')
})
it('truncates array values longer than truncate (19)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 19 })).to.equal('Buffer[ 1, …(2) ]')
})
it('truncates array values longer than truncate (18)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 18 })).to.equal('Buffer[ 1, …(2) ]')
})
it('truncates array values longer than truncate (17)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 17 })).to.equal('Buffer[ 1, …(2) ]')
})
it('truncates array values longer than truncate (16)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 16 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (15)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 15 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (14)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 14 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (13)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 13 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (12)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 12 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (11)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 11 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (10)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 10 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (9)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 9 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (8)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 8 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (8)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 8 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (8)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 8 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (7)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 7 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (6)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 6 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (5)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 5 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (4)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 4 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (3)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 3 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (2)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 2 })).to.equal('Buffer[ …(3) ]')
})
it('truncates array values longer than truncate (1)', () => {
expect(inspect(Buffer.from([1, 2, 3]), { truncate: 1 })).to.equal('Buffer[ …(3) ]')
})
})
})