Fails to use testFilename in unittest

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 18 03:05:41 PDT 2017


On Thursday, May 18, 2017 09:56:36 biocyberman via Digitalmars-d-learn 
wrote:
> On Thursday, 18 May 2017 at 09:49:26 UTC, Jonathan M Davis wrote:
> > On Thursday, May 18, 2017 09:40:33 biocyberman via
> >
> > Digitalmars-d-learn wrote:
> >> [...]
> >
> > Actually, it's not used all over the place in Phobos. It's only
> > used std.stdio, where it's a private function in a
> > version(unittest) block. It's not part of the public API. And
> > other modules that need something similar have their own
> > solution.
> >
> > [...]
>
> That's exactly the code  I looked at. And yes, I checked
> std.stdio to see many occurrences of testFilename.

My point is that it's a private function for testing std.stdio and not
intended to be part of the public API or be used by anyone else (it's not
even used anywhere else in Phobos). None of the functions in Phobos that do
that sort of thing are in the public API. You can copy-paste testFilename
(and std.file.deleteme, since it uses that) into your own code and use them
if you like, but the ones in Phobos are just there for Phobos. The only unit
testing-specific functionality that Phobos provides beyond what the language
itself has is in std.exception with functions such as assertThrown.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list