This revision was automatically updated to reflect the committed changes. Closed by commit rL330609: [clangd][tests] Fix delimiter handling (authored by jkorous, committed by ). Herald added subscribers: llvm-commits, klimek.
Changed prior to commit: https://reviews.llvm.org/D45764?vs=142918&id=143573#toc Repository: rL LLVM https://reviews.llvm.org/D45764 Files: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test Index: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp =================================================================== --- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp +++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp @@ -278,7 +278,7 @@ continue; // found a delimiter - if (LineRef.find_first_not_of('-') == llvm::StringRef::npos) + if (LineRef.rtrim() == "---") break; JSON += Line; Index: clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test =================================================================== --- clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test +++ clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test @@ -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
Index: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp =================================================================== --- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp +++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp @@ -278,7 +278,7 @@ continue; // found a delimiter - if (LineRef.find_first_not_of('-') == llvm::StringRef::npos) + if (LineRef.rtrim() == "---") break; JSON += Line; Index: clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test =================================================================== --- clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test +++ clang-tools-extra/trunk/test/clangd/spaces-in-delimited-input.test @@ -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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits