================
@@ -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");
----------------
JDevlieghere wrote:

I was thinking about ways to make the test easier to write. I'm not super 
thrilled about putting JSON into the tests but maybe it's not worse than how 
verbose the current approach is. I think my preference would be to have what I 
did for the `Source` struct: if every type has both a fromJSON and toJSON, then 
we can just roundtrip every object. 

https://github.com/llvm/llvm-project/pull/139502
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to