protected string Run(string stdin, out CompilerContext context)
{
TextWriter oldStdOut = Console.Out;
TextReader oldStdIn = Console.In;
try
{
Console.SetOut(_output);
if (null != stdin)
{
Console.SetIn(new StringReader(stdin));
}
context = _compiler.Run();
if (HasErrors(context) && !IgnoreErrors)
{
Assert.Fail(GetFirstInputName(context)
+ ": "
+ context.Errors.ToString(false)
+ context.Warnings.ToString());
}
return _output.ToString().Replace("\r\n", "\n");
}
finally
{
_output.GetStringBuilder().Length = 0;
Console.SetOut(oldStdOut);
Console.SetIn(oldStdIn);
}
}