File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,30 @@ describe('parsers', function () {
424424 assert . strictEqual ( replyCount , 1 )
425425 } )
426426
427+ it ( 'multiple chunks with nested partial arrays' , function ( ) {
428+ var predefinedData = [
429+ 'abcdefghijabcdefghij' ,
430+ 100 ,
431+ '1234567890' ,
432+ 100
433+ ]
434+ function checkReply ( reply ) {
435+ assert . strictEqual ( reply . length , 1 )
436+ for ( var i = 0 ; i < reply [ 0 ] . length ; i ++ ) {
437+ assert . strictEqual ( reply [ 0 ] [ i ] , predefinedData [ i ] )
438+ }
439+ replyCount ++
440+ }
441+ var parser = newParser ( {
442+ returnReply : checkReply
443+ } )
444+ parser . execute ( new Buffer ( '*1\r\n*4\r\n+abcdefghijabcdefghij\r\n:100' ) )
445+ parser . execute ( new Buffer ( '\r\n$10\r\n1234567890\r\n:100' ) )
446+ assert . strictEqual ( replyCount , 0 )
447+ parser . execute ( new Buffer ( '\r\n' ) )
448+ assert . strictEqual ( replyCount , 1 )
449+ } )
450+
427451 it ( 'return normal errors' , function ( ) {
428452 function checkReply ( reply ) {
429453 assert . strictEqual ( reply . message , 'Error message' )
You can’t perform that action at this time.
0 commit comments