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
signature.asc
Description: This is a digitally signed message part