View previous topic :: View next topic |
Author |
Message |
greatgatsby
Joined: 06 Aug 2010 Posts: 10 Location: South Africa (Cape Town)
|
Posted: Wed Jul 25, 2012 2:52 pm Post subject: Redirect stdout to output window not working |
|
|
Hi Rainer,
I want to run unittests on a static lib project, so I am using the advice you gave a previous poster i.e. to add
Code: | version(UnitTest) void main() {} |
to the lib project. This works great, so the tests all run as expected!.
The unittests are all very straightforward and follows this format
Code: | unittest
{
writeln("Testing function.. Foo...");
...some code...
assert(x == y, "ERROR!");
writeln("PASS!");
} |
I would like to show the writeln output in Visual Studio's Output window, so I've ticket the Debug Option "Redirect stdout to output window" in my UnitTest configuration options.
But this has no effect - when I run the unittests it still opens a Console window and displays all the writeln output there. So it appears that stdout is not being redicted to the Output window.
Likewise the option "Pause when Program finishes" has no effect - the Console window closes at the end (if no breakpoint is set) and the Debug session terminates.
I wondered if this had anything to do with the fact that the project type is a atatic lib (stdout defined for a lib?), so I also made a test console application project and tried both options in the standard Debug configuration. Both did not work here either.
I am using Visual Studio 2008 on Win XP.
Regards,
Ettienne[/quote] |
|
Back to top |
|
|
greatgatsby
Joined: 06 Aug 2010 Posts: 10 Location: South Africa (Cape Town)
|
Posted: Thu Jul 26, 2012 5:33 am Post subject: |
|
|
Forgot to mention: I am using VisualD v0.3.33.
Regards,
Ettienne |
|
Back to top |
|
|
sagitario
Joined: 03 Mar 2007 Posts: 292
|
Posted: Mon Aug 06, 2012 12:55 am Post subject: |
|
|
Hi,
Quote: | But this has no effect - when I run the unittests it still opens a Console window and displays all the writeln output there. So it appears that stdout is not being redicted to the Output window.
|
Redirection seems to work only for the "Visual Studio (x86 Mixed Mode)" debug engine. I have no idea why it is not implemented for the native engine aswell. This should be made more clear in the dialog.
Quote: | Likewise the option "Pause when Program finishes" has no effect - the Console window closes at the end (if no breakpoint is set) and the Debug session terminates. |
As the section header suggests, this only works if you run the debuggee without debugger (with Ctrl+F5). I know this is not ideal, but it is the same for C++/C# projects.
Regards and sorry for the late reply,
Rainer |
|
Back to top |
|
|
|