diff options
Diffstat (limited to 'clang-tools-extra/unittests/clangd/JSONTransportTests.cpp')
| -rw-r--r-- | clang-tools-extra/unittests/clangd/JSONTransportTests.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/clang-tools-extra/unittests/clangd/JSONTransportTests.cpp b/clang-tools-extra/unittests/clangd/JSONTransportTests.cpp index 8f9d40bd475..f9afb4de251 100644 --- a/clang-tools-extra/unittests/clangd/JSONTransportTests.cpp +++ b/clang-tools-extra/unittests/clangd/JSONTransportTests.cpp @@ -12,7 +12,6 @@ #include "gtest/gtest.h" #include <stdio.h> -using namespace llvm; namespace clang { namespace clangd { namespace { @@ -25,7 +24,7 @@ namespace { // Fixture takes care of managing the input/output buffers for the transport. class JSONTransportTest : public ::testing::Test { std::string InBuf, OutBuf, MirrorBuf; - raw_string_ostream Out, Mirror; + llvm::raw_string_ostream Out, Mirror; std::unique_ptr<FILE, int (*)(FILE *)> In; protected: @@ -52,40 +51,43 @@ protected: class Echo : public Transport::MessageHandler { Transport &Target; std::string LogBuf; - raw_string_ostream Log; + llvm::raw_string_ostream Log; public: Echo(Transport &Target) : Target(Target), Log(LogBuf) {} std::string log() { return Log.str(); } - bool onNotify(StringRef Method, json::Value Params) override { + bool onNotify(llvm::StringRef Method, llvm::json::Value Params) override { Log << "Notification " << Method << ": " << Params << "\n"; if (Method == "call") Target.call("echo call", std::move(Params), 42); return Method != "exit"; } - bool onCall(StringRef Method, json::Value Params, json::Value ID) override { + bool onCall(llvm::StringRef Method, llvm::json::Value Params, + llvm::json::Value ID) override { Log << "Call " << Method << "(" << ID << "): " << Params << "\n"; if (Method == "err") - Target.reply(ID, make_error<LSPError>("trouble at mill", ErrorCode(88))); + Target.reply( + ID, llvm::make_error<LSPError>("trouble at mill", ErrorCode(88))); else Target.reply(ID, std::move(Params)); return true; } - bool onReply(json::Value ID, Expected<json::Value> Params) override { + bool onReply(llvm::json::Value ID, + llvm::Expected<llvm::json::Value> Params) override { if (Params) Log << "Reply(" << ID << "): " << *Params << "\n"; else - Log << "Reply(" << ID << "): error = " << toString(Params.takeError()) - << "\n"; + Log << "Reply(" << ID + << "): error = " << llvm::toString(Params.takeError()) << "\n"; return true; } }; -std::string trim(StringRef S) { return S.trim().str(); } +std::string trim(llvm::StringRef S) { return S.trim().str(); } // Runs an Echo session using the standard JSON-RPC format we use in production. TEST_F(JSONTransportTest, StandardDense) { |

