@@ -47,7 +47,7 @@ export async function testSolution(channel: vscode.OutputChannel, uri?: vscode.U
4747 let result : string | undefined ;
4848 switch ( choice . value ) {
4949 case ":default" :
50- result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , filePath ] ) ;
50+ result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , `" ${ filePath } "` ] ) ;
5151 break ;
5252 case ":direct" :
5353 const testString : string | undefined = await vscode . window . showInputBox ( {
@@ -57,15 +57,15 @@ export async function testSolution(channel: vscode.OutputChannel, uri?: vscode.U
5757 ignoreFocusOut : true ,
5858 } ) ;
5959 if ( testString ) {
60- result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , filePath , "-t" , `"${ testString . replace ( / " / g, "" ) } "` ] ) ;
60+ result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , `" ${ filePath } "` , "-t" , `"${ testString . replace ( / " / g, "" ) } "` ] ) ;
6161 }
6262 break ;
6363 case ":file" :
6464 const testFile : vscode . Uri [ ] | undefined = await showFileSelectDialog ( ) ;
6565 if ( testFile && testFile . length ) {
6666 const input : string = await fse . readFile ( testFile [ 0 ] . fsPath , "utf-8" ) ;
6767 if ( input . trim ( ) ) {
68- result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , filePath , "-t" , `"${ input . replace ( / " / g, "" ) . replace ( / \r ? \n / g, "\\n" ) } "` ] ) ;
68+ result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , `" ${ filePath } "` , "-t" , `"${ input . replace ( / " / g, "" ) . replace ( / \r ? \n / g, "\\n" ) } "` ] ) ;
6969 } else {
7070 vscode . window . showErrorMessage ( "The selected test file must not be empty." ) ;
7171 }
0 commit comments