[Newbies] capturing output in memory
Randal L. Schwartz
merlyn at stonehenge.com
Wed Oct 1 22:53:15 UTC 2008
>>>>> "Mark" == Mark Volkmann <mark at ociweb.com> writes:
Mark> For the purpose of writing unit tests for code that writes to a stream I
Mark> want to use something other than a FileStream that will allow me to
Mark> write to it just like FileStream, but will just hold the data in
Mark> memory. When I'm finished writing, I want to retrieve everything I've
Mark> written as a single String. Is there a class that does that?
myStream = WriteStream new.
" use myStream as if it were a FileStream "
myString := myStream contents.
That's the nice part about the various protocol families. It mostly just
works.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the Beginners
mailing list