[Lldb-commits] [lldb] [lldb-dap] Add unit tests for protocol types (PR #139502)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Mon May 12 10:03:58 PDT 2025
================
@@ -0,0 +1,268 @@
+//===-- ProtocolTypesTest.cpp -----------------------------------*- C++ -*-===//
+//
+// 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/ProtocolTypes.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace lldb;
+using namespace lldb_dap;
+using namespace lldb_dap::protocol;
+
+TEST(ProtocolTypesTest, ExceptionBreakpointsFilter) {
+ ExceptionBreakpointsFilter filter;
+ filter.filter = "testFilter";
+ filter.label = "Test Filter";
+ filter.description = "This is a test filter";
+ filter.defaultState = true;
+ filter.supportsCondition = true;
+ filter.conditionDescription = "Condition for test filter";
+
+ llvm::json::Value value = toJSON(filter);
+ const json::Object *obj = value.getAsObject();
+ ASSERT_NE(obj, nullptr);
+
+ EXPECT_EQ(obj->getString("filter"), "testFilter");
+ EXPECT_EQ(obj->getString("label"), "Test Filter");
+ EXPECT_EQ(obj->getString("description"), "This is a test filter");
+ EXPECT_EQ(obj->getBoolean("default"), true);
+ EXPECT_EQ(obj->getBoolean("supportsCondition"), true);
+ EXPECT_EQ(obj->getString("conditionDescription"),
+ "Condition for test filter");
----------------
ashgti wrote:
We could make it more of a convention to have both going forward for testing purposes.
https://github.com/llvm/llvm-project/pull/139502
More information about the lldb-commits
mailing list