-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep console open after the tests #477
Comments
I was going to make a pull request for this feature at some point, because it would also be useful for catching memory leaks on Mac OS X. That page explains:
Until then, @nicolaje, you can define your own |
@nicolaje I just ran into this as well - for anyone else who runs into this, David provided me the insight I needed to solve it. Steps Listed below:
Note that you'll have to kill the program via visual studio unless you implement another way to end the while loop. |
Alternatively, add switch /SUBSYSTEM:CONSOLE to the linker On 5 May 2016 at 20:11, qwoodmansee [email protected] wrote:
|
This is what I did: #define CATCH_CONFIG_RUNNER
#include <test_helper.h>
int main(int argc, char ** argv)
{
// If the last argument is "-p", then pause after the tests are run.
// This allows us to run "leaks" on Mac OS X to check for memory leaks.
bool pause_after_test = false;
if (argc && std::string(argv[argc - 1]) == "-p")
{
pause_after_test = true;
argc--;
}
int result = Catch::Session().run(argc, argv);
if (pause_after_test)
{
printf("Press enter to continue.");
std::string s;
std::cin >> s;
}
return result;
} Waiting for user input is nicer than just spinning in an infinite loop, taking up CPU time. |
Alternatively,with Visual Sutdio,you can also replace
|
It wouldn't be too much hassle, I assume, to add a As it stands, I've beggered with my own copy a little and added a wait directly into catch.hpp (in blatant violation of the polite request not to change the merged file, sorry). |
Bonjour FYI : everything works fine and I get the colors when I run the application out of the debug session (either from the IDE or directly invoking the test code from a console). Any advise/idea are more than welcome PS : like some others I support the idea of a switch that would let the console on screen during debug sessions |
Sorry this request has been around for quite a while. I know it's a simple feature to add, and I had intended to do so. I've now added it as the See https://github.com/philsquared/Catch/blob/master/docs/command-line.md#wait-for-keypress |
With Visual Sutdio, running Catch tests will close the console after execution, and you can't see the results of the tests unless you set some unintuitive option in a dark corner of the project settings and use a new keyboard shortcut to run the project.
It is more a Visual Studio issue, but it would be great if by default Catch would keep the console open with a dumb getchar(); or at least adding a command line option to keep the console open.
The text was updated successfully, but these errors were encountered: