[Lldb-commits] [PATCH] D82759: [lldb/Test] Introduce "assertSuccess"

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 30 04:51:08 PDT 2020


labath marked 3 inline comments as done.
labath added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/test/lldbtest.py:2537
+    def assertSuccess(self, obj, msg=None):
+        if not obj.Success():
+            error = obj.GetCString()
----------------
teemperor wrote:
> JDevlieghere wrote:
> > I'm not actually sure this works for custom types, but should we add an `assert isinstance(obj, lldb.SBError)` to avoid misuse?
> I actually also wondered if `obj` can be anything else in LLDB's SB API. I guess it's Pythonic to allow anything that fits that signature but some one-line documentaiton that this intended is for SBError would be nice.
Yeah, duck-typing is very pythonic :P. At one point I actually had this special-case SBCommandReturnObject (It has `Succeeded` (:/) and `GetError` methods, but then I realized those are better handled by `runCmd` and friends.

I'll add some documentation about SBError.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82759/new/

https://reviews.llvm.org/D82759





More information about the lldb-commits mailing list