vscode-leetcode icon indicating copy to clipboard operation
vscode-leetcode copied to clipboard

can't write test case if the testcase contains escape char

Open tongluyang opened this issue 6 years ago • 0 comments

🐛 Bug Report

I test my code by "Write directly"

the testcase is

"dir\\n\\tsubdir1\\n\\tsubdir2\\n\\t\\tfile.ext"

it have some '\n'

I want submit '\n' to leetcode, but it eaten by the extension, and I got an error

Error

com.eclipsesource.json.ParseException: Expected valid escape sequence at 1:6 at line 379, com.eclipsesource.json.JsonParser.error at line 372, com.eclipsesource.json.JsonParser.expected at line 250, com.eclipsesource.json.JsonParser.readEscape at line 202, com.eclipsesource.json.JsonParser.readStringInternal at line 193, com.eclipsesource.json.JsonParser.readString at line 90, com.eclipsesource.json.JsonParser.readValue at line 121, com.eclipsesource.json.JsonParser.readArray at line 92, com.eclipsesource.json.JsonParser.readValue at line 73, com.eclipsesource.json.JsonParser.parse at line 126, com.eclipsesource.json.JsonValue.readFrom at line 133, com.eclipsesource.json.JsonArray.readFrom at Deserializer.toString(Unknown Source) at line 82, Driver.main

Your Input

"dir\ \\tsubdir1\ \\tsubdir2\ \\t\\tfile.ext"

To Reproduce

1、leetcode, No. 388 https://leetcode-cn.com/problems/longest-absolute-file-path/description/ 2、test code, Testcase Example: "dir\\n\\tsubdir1\\n\\tsubdir2\\n\\t\\tfile.ext" 3、error

also i try to change the testcase to "dir\\\\n\\\\tsubdir1\\\\n\\\\tsubdir2\\\\n\\\\t\\\\tfile.ext"

then I got a response Your Input

"dir\\\ \\\\tsubdir1\\\ \\\\tsubdir2\\\ \\\\t\\\\tfile.ext"

Expected behavior

escape '\n'

Extension Output

Paste here the LeetCode extension log from output channel.

  • Waiting for judge result × Runtime Error × Error: com.eclipsesource.json.ParseException: Expected valid escape sequence at 1:6 at line 379, com.eclipsesource.json.JsonParser.error at line 372, com.eclipsesource.json.JsonParser.expected at line 250, com.eclipsesource.json.JsonParser.readEscape at line 202, com.eclipsesource.json.JsonParser.readStringInternal at line 193, com.eclipsesource.json.JsonParser.readString at line 90, com.eclipsesource.json.JsonParser.readValue at line 121, com.eclipsesource.json.JsonParser.readArray at line 92, com.eclipsesource.json.JsonParser.readValue at line 73, com.eclipsesource.json.JsonParser.parse at line 126, com.eclipsesource.json.JsonValue.readFrom at line 133, com.eclipsesource.json.JsonArray.readFrom at Deserializer.toString(Unknown Source) at line 82, Driver.main × Your Input: "dir
    \tsubdir1
    \tsubdir2
    \t\tfile.ext" × Stdout:

Your Environment

  • os: win10
  • extension settings: Default except "leetcode.endpoint": "leetcode-cn", "leetcode.showCommentDescription": true
  • nodejs version: v10.15.3
  • vscode version: 1.45.1
  • extension version: 0.16.2

tongluyang avatar May 30 '20 05:05 tongluyang