| 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 |
|
| 19 |
using namespace llvm; |
| 20 |
using namespace lldb; |
| 21 |
using namespace lldb_dap; |
| 22 |
using namespace lldb_dap_tests; |
| 23 |
using namespace lldb_dap::protocol; |
| 24 |
|
| 25 |
class DAPTest : public TransportBase {}; |
| 26 |
|
| 27 |
TEST_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(Event{/*event=*/"my-event", /*body=*/std::nullopt}); |
| 35 |
ASSERT_THAT_EXPECTED( |
| 36 |
from_dap->Read<protocol::Message>(std::chrono::milliseconds(1)), |
| 37 |
HasValue(testing::VariantWith<Event>(testing::FieldsAre( |
| 38 |
/*event=*/"my-event", /*body=*/std::nullopt)))); |
| 39 |
} |