Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 26285a5

Browse files
Denys Smirnovdennwc
authored andcommitted
fix type in comment processor and add a test
Signed-off-by: Denys Smirnov <denys@sourced.tech>
1 parent d5e5531 commit 26285a5

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

native/src/main/java/bblfsh/CommentVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ private boolean visitBlock(Comment node) {
5757

5858
int startCol = lineCount == startLineNumber ? startLineColumn : 0;
5959
int endCol = lineCount == endLineNumber ? endLineColumn : source[lineCount].length();
60-
String blockCommentLine = source[lineCount].substring(startLineColumn, endCol).trim();
60+
61+
String blockCommentLine = source[lineCount].substring(startCol, endCol).trim();
6162

6263
blockComment.append(blockCommentLine);
6364
if (lineCount != endLineNumber) {

native/src/test/java/bblfsh/DriverTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,18 @@ public void processInvalid() throws DriverException, CloseException {
6969
final String result = new String(out.toByteArray());
7070
assertThat(result).isEqualTo("{\"status\":\"fatal\",\"errors\":[\"Unrecognized token 'garbage': was expecting ('true', 'false' or 'null')\\n at [Source: garbage; line: 1, column: 15]\"]}\n");
7171
}
72+
73+
@Test
74+
public void processComment() throws DriverException, CloseException {
75+
final String input = "{\"content\":\"class EOF_Test { public void method() {\\r\\n /*\\r\\n*/ } }\"}";
76+
final InputStream in = new ByteArrayInputStream(input.getBytes());
77+
final RequestReader reader = new RequestReader(in);
78+
79+
final ByteArrayOutputStream out = new ByteArrayOutputStream();
80+
final ResponseWriter writer = new ResponseWriter(out);
81+
82+
final Driver driver = new Driver(reader, writer);
83+
driver.processOne();
84+
//TODO: check output
85+
}
7286
}

0 commit comments

Comments
 (0)