1//===-- DAPTest.cpp -------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "DAP.h"
10#include "Protocol/ProtocolBase.h"
11#include "TestBase.h"
12#include "Transport.h"
13#include "llvm/Testing/Support/Error.h"
14#include "gtest/gtest.h"
15#include <chrono>
16#include <memory>
17#include <optional>
18
19using namespace llvm;
20using namespace lldb;
21using namespace lldb_dap;
22using namespace lldb_dap_tests;
23using namespace lldb_dap::protocol;
24
25class DAPTest : public TransportBase {};
26
27TEST_F(DAPTest, SendProtocolMessages) {
28 DAP dap{
29 /*log=*/nullptr,
30 /*default_repl_mode=*/ReplMode::Auto,
31 /*pre_init_commands=*/{},
32 /*transport=*/*to_dap,
33 };
34 dap.Send(message: Event{/*event=*/"my-event", /*body=*/std::nullopt});
35 ASSERT_THAT_EXPECTED(from_dap->Read(std::chrono::milliseconds(1)),
36 HasValue(testing::VariantWith<Event>(testing::FieldsAre(
37 /*event=*/"my-event", /*body=*/std::nullopt))));
38}
39

source code of lldb/unittests/DAP/DAPTest.cpp