50 int result =
static_cast<int>(
51 wxExecute( wxS(
"cmd.exe /c " ) + aCmd, wxEXEC_SYNC, &
process ) );
53 const wchar_t* argv[] = { wxS(
"/bin/sh" ), wxS(
"-c" ), aCmd.wc_str(),
nullptr };
54 int result =
static_cast<int>( wxExecute( argv, wxEXEC_SYNC, &
process ) );
57 wxInputStream* inputStream =
process.GetInputStream();
61 wxTextInputStream textStream( *inputStream );
63 while( !inputStream->Eof() )
65 wxString line = textStream.ReadLine();
67 if( !line.IsEmpty() || !inputStream->Eof() )
69 if( !aOutput.IsEmpty() )
70 aOutput += wxS(
"\n" );
96 wxString tempDir = wxFileName::GetTempDir() + wxFileName::GetPathSeparator()
97 + wxS(
"kicad_test_glob_" ) + wxString::Format( wxS(
"%d" ), (
int) getpid() );
99 BOOST_REQUIRE( wxFileName::Mkdir( tempDir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) );
103 wxString path1 = tempDir + wxFileName::GetPathSeparator() + wxS(
"file_a.txt" );
104 wxString path2 = tempDir + wxFileName::GetPathSeparator() + wxS(
"file_b.txt" );
106 file1.Create( path1 );
107 file1.Write( wxS(
"content_a" ) );
110 file2.Create( path2 );
111 file2.Write( wxS(
"content_b" ) );
116 wxString cmd = wxString::Format( wxS(
"dir /b \"%s\\*.txt\"" ), tempDir );
118 wxString cmd = wxString::Format( wxS(
"ls %s/*.txt" ), tempDir );
126 "Glob should expand to include file_a.txt, got: " +
output );
128 "Glob should expand to include file_b.txt, got: " +
output );
130 wxRemoveFile( path1 );
131 wxRemoveFile( path2 );
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")