| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 991251f commit e72b2b4
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,3 +48,37 @@ const shifted = list.shift(); | |||
| 48 | 48 | testIterator(list, 0); | |
| 49 | 49 | assert.strictEqual(shifted, buf); | |
| 50 | 50 | assert.deepStrictEqual(list, new BufferList()); | |
| 51 | + | ||
| 52 | + { | ||
| 53 | + const list = new BufferList(); | ||
| 54 | + list.push('foo'); | ||
| 55 | + list.push('bar'); | ||
| 56 | + list.push('foo'); | ||
| 57 | + list.push('bar'); | ||
| 58 | + assert.strictEqual(list.consume(6, true), 'foobar'); | ||
| 59 | + assert.strictEqual(list.consume(6, true), 'foobar'); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + { | ||
| 63 | + const list = new BufferList(); | ||
| 64 | + list.push('foo'); | ||
| 65 | + list.push('bar'); | ||
| 66 | + assert.strictEqual(list.consume(5, true), 'fooba'); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + { | ||
| 70 | + const list = new BufferList(); | ||
| 71 | + list.push(buf); | ||
| 72 | + list.push(buf); | ||
| 73 | + list.push(buf); | ||
| 74 | + list.push(buf); | ||
| 75 | + assert.strictEqual(list.consume(6).toString(), 'foofoo'); | ||
| 76 | + assert.strictEqual(list.consume(6).toString(), 'foofoo'); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + { | ||
| 80 | + const list = new BufferList(); | ||
| 81 | + list.push(buf); | ||
| 82 | + list.push(buf); | ||
| 83 | + assert.strictEqual(list.consume(5).toString(), 'foofo'); | ||
| 84 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments