[clangd][tests] Fix delimiter handling

Empty line shouldn't be considered a delimiter

Differential Revision: https://reviews.llvm.org/D45764

llvm-svn: 330609
This commit is contained in:
Jan Korous 2018-04-23 15:58:42 +00:00
parent 6243515139
commit 1bc528cd9a
2 changed files with 14 additions and 1 deletions

View File

@ -278,7 +278,7 @@ static llvm::Optional<std::string> readDelimitedMessage(std::istream &In,
continue;
// found a delimiter
if (LineRef.find_first_not_of('-') == llvm::StringRef::npos)
if (LineRef.rtrim() == "---")
break;
JSON += Line;

View File

@ -0,0 +1,13 @@
# RUN: clangd -input-style=delimited -run-synchronously < %s 2>&1 | FileCheck %s
# RUN: clangd -lit-test -run-synchronously < %s 2>&1 | FileCheck %s
#
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
---
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
---
{"jsonrpc":"2.0","id":3,"method":"exit"}
# CHECK-NOT: JSON parse error