llvm/clang-tools-extra/clangd/unittests/JSONTransportTests.cpp

//===-- JSONTransportTests.cpp  -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "Protocol.h"
#include "Transport.h"
#include "support/Cancellation.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdio>

namespace clang {
namespace clangd {
namespace {

// No fmemopen on windows or on versions of MacOS X earlier than 10.13, so we
// can't easily run this test.
#if !(defined(_WIN32) || (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
                          __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300))

// Fixture takes care of managing the input/output buffers for the transport.
class JSONTransportTest : public ::testing::Test {};

// Echo is a simple server running on a transport:
//   - logs each message it gets.
//   - when it gets a call, replies to it
//   - when it gets a notification for method "call", makes a call on Target
// Hangs up when it gets an exit notification.
class Echo : public Transport::MessageHandler {};

std::string trim(llvm::StringRef S) {}

// Runs an Echo session using the standard JSON-RPC format we use in production.
TEST_F(JSONTransportTest, StandardDense) {}

// Runs an Echo session using the "delimited" input and pretty-printed output
// that we use in lit tests.
TEST_F(JSONTransportTest, DelimitedPretty) {}

// IO errors such as EOF ane reported.
// The only successful return from loop() is if a handler returned false.
TEST_F(JSONTransportTest, EndOfFile) {}

#endif

} // namespace
} // namespace clangd
} // namespace clang