[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[nodeJS] 051 fromString
SwikiCodeRobot @> #testNodeJSFromString |
"Allocate NodeBuffer from a String instance."
| hello buffer |
hello := Point fileOut.
1000 timesRepeat: [:i|
buffer := NodeBuffer string: hello.
(buffer toString: #ascii) = hello ifFalse: [
self error: 'Wrong contents [',i,']'
].
buffer length = hello size ifFalse: [
self error: 'Wrong size [',i,']'
].
].
"Allocate NodeBuffer from multiple String instances"
| hello buffer |
100 timesRepeat: [:i|
hello := Object selectors asString.
buffer := NodeBuffer string: hello.
(buffer toString: #ascii) = hello ifFalse: [
self error: 'Wrong contents [',i,']'
].
buffer length = hello size ifFalse: [
self error: 'Wrong size [',i,']'
].
].