mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-30 09:01:19 +00:00
[Python] Implement truth testing for lldb.value
Python 3 calls __bool__() instead of __len__() and lldb.value only implemented the __len__ method. This adds the __bool__() implementation. Differential revision: https://reviews.llvm.org/D67183 llvm-svn: 370953
This commit is contained in:
parent
5559406ae5
commit
24223eb24c
@ -160,6 +160,10 @@ class ValueAPITestCase(TestBase):
|
||||
val_i.GetType()).AddressOf(),
|
||||
VALID_VARIABLE)
|
||||
|
||||
# Check that lldb.value implements truth testing.
|
||||
self.assertFalse(lldb.value(frame0.FindVariable('bogus')))
|
||||
self.assertTrue(lldb.value(frame0.FindVariable('uinthex')))
|
||||
|
||||
self.assertTrue(int(lldb.value(frame0.FindVariable('uinthex')))
|
||||
== 3768803088, 'uinthex == 3768803088')
|
||||
self.assertTrue(int(lldb.value(frame0.FindVariable('sinthex')))
|
||||
|
@ -980,6 +980,9 @@ class value(object):
|
||||
def __nonzero__(self):
|
||||
return self.sbvalue.__nonzero__()
|
||||
|
||||
def __bool__(self):
|
||||
return self.sbvalue.__bool__()
|
||||
|
||||
def __str__(self):
|
||||
return self.sbvalue.__str__()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user