Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8da833

Browse files
authored
Fix the bug that quotes are not accepted in test cases (LeetCode-OpenSource#111)
1 parentcae75fe commite8da833

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/commands/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ export async function testSolution(uri?: vscode.Uri): Promise<void> {
5959
ignoreFocusOut:true,
6060
});
6161
if(testString){
62-
result=awaitleetCodeExecutor.testSolution(filePath,testString.replace(/"/g,""));
62+
result=awaitleetCodeExecutor.testSolution(filePath,testString);
6363
}
6464
break;
6565
case":file":
6666
consttestFile:vscode.Uri[]|undefined=awaitshowFileSelectDialog();
6767
if(testFile&&testFile.length){
6868
constinput:string=awaitfse.readFile(testFile[0].fsPath,"utf-8");
6969
if(input.trim()){
70-
result=awaitleetCodeExecutor.testSolution(filePath,input.replace(/"/g,"").replace(/\r?\n/g,"\\n"));
70+
result=awaitleetCodeExecutor.testSolution(filePath,input.replace(/\r?\n/g,"\\n"));
7171
}else{
7272
vscode.window.showErrorMessage("The selected test file must not be empty.");
7373
}

‎src/leetCodeExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class LeetCodeExecutor {
9696

9797
publicasynctestSolution(filePath:string,testString?:string):Promise<string>{
9898
if(testString){
99-
returnawaitthis.executeCommandWithProgressEx("Submitting to LeetCode...","node",[awaitthis.getLeetCodeBinaryPath(),"test",`"${filePath}"`,"-t",`"${testString}"`]);
99+
returnawaitthis.executeCommandWithProgressEx("Submitting to LeetCode...","node",[awaitthis.getLeetCodeBinaryPath(),"test",`"${filePath}"`,"-t",`'${testString}'`]);
100100
}
101101
returnawaitthis.executeCommandWithProgressEx("Submitting to LeetCode...","node",[awaitthis.getLeetCodeBinaryPath(),"test",`"${filePath}"`]);
102102
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp