For the purpose of writing unit tests for code that writes to a stream I want to use something other than a FileStream that will allow me to write to it just like FileStream, but will just hold the data in memory. When I'm finished writing, I want to retrieve everything I've written as a single String. Is there a class that does that?
--- Mark Volkmann
"Mark" == Mark Volkmann mark@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" == Randal L Schwartz merlyn@stonehenge.com writes:
Randal> myStream = WriteStream new.
Sorry. (WriteStream on: '')
Randal> " use myStream as if it were a FileStream " Randal> myString := myStream contents.
Randal> That's the nice part about the various protocol families. It mostly just Randal> works.
Randal> -- Randal> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Randal> merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Randal> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. Randal> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
beginners@lists.squeakfoundation.org