title: In-memory File for unittesting
body: <p>I'd like to write a unit-test for a method that prints to the standard output.
  I have already changed the code so it prints to a passed-in <code>File</code> instance instead that is <code>stdout</code> by default. The only thing I am missing is some in-memory <code>File</code> instance that I could pass-in. Is there such a thing? Any recommendation? I wish something like this worked:</p>
  
  <pre><code>import std.stdio;
  
  void greet(File f = stdout) {
      f.writeln("hello!");
  }
  
  unittest {
      greet(inmemory);
      assert(inmemory.content == "hello!\n")
  }
  
  void main() {
      greet();
  }
  </code></pre>
  
  <p>Any other approach for unit-testing code that prints to <code>stdout</code>?</p>