[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[nodeJS] 051 concat
SwikiCodeRobot @> #testNodeJSConcat |
"Buffer concat test"
| hello zero one long flatZero flatOne flatLong flatLongLen |
hello := #hello.
zero := #().
one := Array with: (NodeBuffer string: hello).
long := (1 to: 10) collect: [:i| NodeBuffer string: hello ].
flatZero := NodeBuffer concat: zero.
flatOne := NodeBuffer concat: one.
flatLong := NodeBuffer concat: long.
"flatLongLen := NodeBuffer concat: long totalLength: 40."
flatZero length = 0 ifFalse: [ self error: 'Wrong flat Zero' ].
(flatOne toString: #ascii) = hello ifFalse: [ self error: 'Wrong flat One contents' ].
flatOne handle #== one first handle ifFalse: [ self error: 'One equal test failed' ].
flatLong handle toString = (long inject: '' into: [:total :each| total , hello ]) ifFalse: [ self error: 'Wrong flatLong contents' ].
"flatLongLen handle toString = (long inject: '' into: [:total :each| total , hello ]) ifFalse: [ self error: 'Wrong flatLongLen contents' ]."