Tempfiles in unittests
Jonathan M Davis
jmdavisProg at gmx.com
Sat Mar 10 09:10:52 PST 2012
On Saturday, March 10, 2012 15:44:26 Magnus Lie Hetland wrote:
> On 2012-03-09 18:42:01 +0000, Jonathan M Davis said:
> > File has a name property. You can do something like
> >
> > auto file = File.tmpfile();
> > auto filename = file.name;
> > auto str = readText(filename);
>
> Yeah -- again, sorry my original post was so verbose, but part of the
> "problem spec" was that my tempfiles don't seem to have names (i.e.,
> they are unnamed tempfiles, and file.name is null; platform-dependent,
> I think).
>
> Otherwise, this wouldn't have been a problem :)
Then you'll probably have to write a wrapper function which just uses byLine
and join to grab the string line by line and then put it back together again.
As annoying as it may be, it wouldn't be hard.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list