FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Redirect stdout to output window not working

 
Post new topic   Reply to topic     Forum Index -> Visual D
View previous topic :: View next topic  
Author Message
greatgatsby



Joined: 06 Aug 2010
Posts: 10
Location: South Africa (Cape Town)

PostPosted: Wed Jul 25, 2012 2:52 pm    Post subject: Redirect stdout to output window not working Reply with quote

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
View user's profile Send private message
greatgatsby



Joined: 06 Aug 2010
Posts: 10
Location: South Africa (Cape Town)

PostPosted: Thu Jul 26, 2012 5:33 am    Post subject: Reply with quote

Forgot to mention: I am using VisualD v0.3.33.

Regards,
Ettienne
Back to top
View user's profile Send private message
sagitario



Joined: 03 Mar 2007
Posts: 292

PostPosted: Mon Aug 06, 2012 12:55 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Visual D All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group