Skip to content

Commit d8665bb

Browse files
authored
[lldb-dap] Add ContinueRequestHandler unit test (llvm#140566)
Add a simple unit test for the ContinueRequestHandler that checks that it returns an error when the (dummy process) is not stopped.
1 parent fe1c482 commit d8665bb

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

lldb/unittests/DAP/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ add_lldb_unittest(DAPTests
22
DAPTest.cpp
33
FifoFilesTest.cpp
44
Handler/DisconnectTest.cpp
5+
Handler/ContinueTest.cpp
56
JSONUtilsTest.cpp
67
LLDBUtilsTest.cpp
78
ProtocolTypesTest.cpp
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//===-- ContinueTest.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 "Handler/RequestHandler.h"
11+
#include "Protocol/ProtocolRequests.h"
12+
#include "TestBase.h"
13+
#include "llvm/Testing/Support/Error.h"
14+
#include "gtest/gtest.h"
15+
16+
using namespace llvm;
17+
using namespace lldb;
18+
using namespace lldb_dap;
19+
using namespace lldb_dap_tests;
20+
using namespace lldb_dap::protocol;
21+
22+
class ContinueRequestHandlerTest : public DAPTestBase {};
23+
24+
TEST_F(ContinueRequestHandlerTest, NotStopped) {
25+
SBTarget target;
26+
dap->debugger.SetSelectedTarget(target);
27+
28+
ContinueRequestHandler handler(*dap);
29+
30+
ContinueArguments args_all_threads;
31+
args_all_threads.singleThread = false;
32+
args_all_threads.threadId = 0;
33+
34+
auto result_all_threads = handler.Run(args_all_threads);
35+
EXPECT_THAT_EXPECTED(result_all_threads,
36+
llvm::FailedWithMessage("not stopped"));
37+
38+
ContinueArguments args_single_thread;
39+
args_single_thread.singleThread = true;
40+
args_single_thread.threadId = 1234;
41+
42+
auto result_single_thread = handler.Run(args_single_thread);
43+
EXPECT_THAT_EXPECTED(result_single_thread,
44+
llvm::FailedWithMessage("not stopped"));
45+
}

0 commit comments

Comments
 (0)