[Lldb-commits] [lldb] [lldb/API] Fix SBStructuredData support any JSON type (PR #101929)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 01:45:31 PDT 2024


================
@@ -110,6 +110,23 @@ class MyRandomClass:
         self.assertTrue(my_random_class)
         self.assertEqual(my_random_class.payload, MyRandomClass.payload)
 
+        example_arr = [1, 2.3, "4", {"5": False}]
+        arr_str = json.dumps(example_arr)
+        s.Clear()
+        s.Print(arr_str)
+        example = lldb.SBStructuredData()
+
+        # Check SetFromJSON API for dictionaries, integers, floating point
+        # values, strings and arrays
+        error = example.SetFromJSON(s)
+        if not error.Success():
+            self.fail("FAILED:   " + error.GetCString())
----------------
labath wrote:

I see you've resolved this comment, but I don't actually understand how. Is your code in some way better than assertSuccess (which exists precisely so it can print the error message when the SBError is in failure state)?

https://github.com/llvm/llvm-project/pull/101929


More information about the lldb-commits mailing list