suppress output from the test commands; use CPPUNIT_ASSERT_EQUAL() whenever possible

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-04-13 17:33:33 +00:00
parent 9b5e0a6dea
commit 561ff470ca

View File

@@ -25,13 +25,13 @@
#ifdef __UNIX__ #ifdef __UNIX__
#define COMMAND "echo hi" #define COMMAND "echo hi"
#define ASYNC_COMMAND "xclock" #define ASYNC_COMMAND "xclock"
#define SHELL_COMMAND "echo hi from shell" #define SHELL_COMMAND "echo hi from shell>/dev/null"
#define REDIRECT_COMMAND "cat -n Makefile" #define COMMAND_NO_OUTPUT "echo -n"
#elif defined(__WXMSW__) #elif defined(__WXMSW__)
#define COMMAND "cmd.exe /c \"echo hi\"" #define COMMAND "cmd.exe /c \"echo hi\""
#define ASYNC_COMMAND "notepad" #define ASYNC_COMMAND "notepad"
#define SHELL_COMMAND "echo hi" #define SHELL_COMMAND "echo hi > nul:"
#define REDIRECT_COMMAND COMMAND #define COMMAND_NO_OUTPUT COMMAND " > nul:"
#else #else
#error "no command to exec" #error "no command to exec"
#endif // OS #endif // OS
@@ -73,8 +73,9 @@ void ExecTestCase::TestShell()
void ExecTestCase::TestExecute() void ExecTestCase::TestExecute()
{ {
// test sync exec: // test sync exec (with a command not producing any output to avoid
CPPUNIT_ASSERT( wxExecute(COMMAND, wxEXEC_SYNC) == 0 ); // interfering with the test):
CPPUNIT_ASSERT( wxExecute(COMMAND_NO_OUTPUT, wxEXEC_SYNC) == 0 );
// test asynch exec // test asynch exec
long pid = wxExecute(ASYNC_COMMAND, wxEXEC_ASYNC); long pid = wxExecute(ASYNC_COMMAND, wxEXEC_ASYNC);
@@ -90,8 +91,8 @@ void ExecTestCase::TestExecute()
// test running COMMAND again, but this time with redirection: // test running COMMAND again, but this time with redirection:
wxArrayString stdout_arr; wxArrayString stdout_arr;
CPPUNIT_ASSERT( wxExecute(COMMAND, stdout_arr, wxEXEC_SYNC) == 0 ); CPPUNIT_ASSERT_EQUAL( 0, wxExecute(COMMAND, stdout_arr, wxEXEC_SYNC) );
CPPUNIT_ASSERT( stdout_arr[0] == "hi" ); CPPUNIT_ASSERT_EQUAL( "hi", stdout_arr[0] );
} }
void ExecTestCase::TestProcess() void ExecTestCase::TestProcess()