File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines 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
+ }
You can’t perform that action at this time.
0 commit comments