Temporary file creation for unittests

Atila Neves atila.neves at gmail.com
Mon May 21 15:16:11 UTC 2018


On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote:
> Hi,
>
> What's the current official position on how to create temporary 
> files for use during a unittest. I found

Not official, but...

     import unit_threaded;

     with(const Sandbox()) {
         writeFile("myfile.txt", "contents");
         shouldExist("myfile.txt");
         shouldEqualContent("myfile.txt", "contents");
         fileShouldContain("myfile.txt", "cont");
     }

Atila


More information about the Digitalmars-d-learn mailing list