import tango.io.Print : Print; import tango.io.TempFile : TempFile; import tango.text.convert.Layout : Layout; // needed for constructing Print!(char) import tango.text.stream.LineIterator; void main(){ scope TempFile fakeConsole = new TempFile(TempFile.Transient); // Write output to fake console scope Print!(char) send = new Print!(char)(new Layout!(char), fakeConsole); send.formatln("TEST"); send.flush(); // Read input from fake console auto receive = new LineIterator!(char)(fakeConsole); char[] capture; receive.readln(capture); assert(capture.length > 0, "Failure to read from temp file"); }