@@ -47,7 +47,7 @@ export async function testSolution(channel: vscode.OutputChannel, uri?: vscode.U
47
47
let result : string | undefined ;
48
48
switch ( choice . value ) {
49
49
case ":default" :
50
- result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , filePath ] ) ;
50
+ result = await executeCommand ( channel , "node" , [ leetCodeBinaryPath , "test" , `" ${ filePath } "` ] ) ;
51
51
break ;
52
52
case ":direct" :
53
53
const testString : string | undefined = await vscode . window . showInputBox ( {
@@ -57,15 +57,15 @@ export async function testSolution(channel: vscode.OutputChannel, uri?: vscode.U
57
57
ignoreFocusOut : true ,
58
58
} ) ;
59
59
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, "" ) } "` ] ) ;
61
61
}
62
62
break ;
63
63
case ":file" :
64
64
const testFile : vscode . Uri [ ] | undefined = await showFileSelectDialog ( ) ;
65
65
if ( testFile && testFile . length ) {
66
66
const input : string = await fse . readFile ( testFile [ 0 ] . fsPath , "utf-8" ) ;
67
67
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" ) } "` ] ) ;
69
69
} else {
70
70
vscode . window . showErrorMessage ( "The selected test file must not be empty." ) ;
71
71
}
0 commit comments