50 const wxString shell = wxS(
"cmd.exe" );
51 const wxString shellFlag = wxS(
"/c" );
53 const wxString shell = wxS(
"/bin/sh" );
54 const wxString shellFlag = wxS(
"-c" );
57 const wchar_t* argv[] = { shell.wc_str(), shellFlag.wc_str(), aCmd.wc_str(),
nullptr };
59 int result =
static_cast<int>(
60 wxExecute(
const_cast<wchar_t**
>( argv ), wxEXEC_SYNC, &
process ) );
62 wxInputStream* inputStream =
process.GetInputStream();
66 wxTextInputStream textStream( *inputStream );
68 while( !inputStream->Eof() )
70 wxString line = textStream.ReadLine();
72 if( !line.IsEmpty() || !inputStream->Eof() )
74 if( !aOutput.IsEmpty() )
75 aOutput += wxS(
"\n" );
101 wxString tempDir = wxFileName::GetTempDir() + wxFileName::GetPathSeparator()
102 + wxS(
"kicad_test_glob_" ) + wxString::Format( wxS(
"%d" ), (
int) getpid() );
104 BOOST_REQUIRE( wxFileName::Mkdir( tempDir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) );
108 wxString path1 = tempDir + wxFileName::GetPathSeparator() + wxS(
"file_a.txt" );
109 wxString path2 = tempDir + wxFileName::GetPathSeparator() + wxS(
"file_b.txt" );
111 file1.Create( path1 );
112 file1.Write( wxS(
"content_a" ) );
115 file2.Create( path2 );
116 file2.Write( wxS(
"content_b" ) );
121 wxString cmd = wxString::Format( wxS(
"dir /b \"%s\\*.txt\"" ), tempDir );
123 wxString cmd = wxString::Format( wxS(
"ls %s/*.txt" ), tempDir );
130 BOOST_CHECK_MESSAGE( output.Contains( wxS(
"file_a.txt" ) ),
131 "Glob should expand to include file_a.txt, got: " + output );
132 BOOST_CHECK_MESSAGE( output.Contains( wxS(
"file_b.txt" ) ),
133 "Glob should expand to include file_b.txt, got: " + output );
135 wxRemoveFile( path1 );
136 wxRemoveFile( path2 );
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")