Temporary file creation for unittests
Russel Winder
russel at winder.org.uk
Mon May 21 17:03:40 UTC 2018
On Mon, 2018-05-21 at 15:16 +0000, Atila Neves via Digitalmars-d-learn wrote:
> 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
OK, we like this. A lot.
Given I use Unit-Threaded, why did I not know this. Ah, OK, RTFM. :-)
Did I mention how much I like this RAII approach?
--
Russel.
==========================================
Dr Russel Winder t: +44 20 7585 2200
41 Buckmaster Road m: +44 7770 465 077
London SW11 1EN, UK w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20180521/b573e154/attachment.sig>
More information about the Digitalmars-d-learn
mailing list