diff options
| author | Raphael Isemann <teemperor@gmail.com> | 2020-02-13 13:40:22 +0100 |
|---|---|---|
| committer | Raphael Isemann <teemperor@gmail.com> | 2020-02-13 15:00:55 +0100 |
| commit | b3a0c4d7dcfa252be17ef5f5b63ffaaa83e01a2b (patch) | |
| tree | f532c1b428f232a9b45c7e210269c072dd70474e /lldb/test/API/functionalities/memory/cache/TestMemoryCache.py | |
| parent | 70e6ed1db709584c6f0ca5f2c7904c74c962dec7 (diff) | |
[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in the test suite
Summary:
The error message from the construct `assertTrue(a == b, "msg") ` are nearly always completely useless for actually debugging the issue.
This patch is just replacing this construct (and similar ones like `assertTrue(a != b, ...)` with the proper call to assertEqual or assertNotEquals.
This patch was mostly written by a shell script with some manual verification afterwards:
```
lang=python
import sys
def sanitize_line(line):
if line.strip().startswith("self.assertTrue(") and " == " in line:
line = line.replace("self.assertTrue(", "self.assertEquals(")
line = line.replace(" == ", ", ", 1)
if line.strip().startswith("self.assertTrue(") and " != " in line:
line = line.replace("self.assertTrue(", "self.assertNotEqual(")
line = line.replace(" != ", ", ", 1)
return line
for a in sys.argv[1:]:
with open(a, "r") as f:
lines = f.readlines()
with open(a, "w") as f:
for line in lines:
f.write(sanitize_line(line))
```
Reviewers: labath, JDevlieghere
Reviewed By: labath
Subscribers: abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D74475
Diffstat (limited to 'lldb/test/API/functionalities/memory/cache/TestMemoryCache.py')
| -rw-r--r-- | lldb/test/API/functionalities/memory/cache/TestMemoryCache.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py b/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py index 8a1523495b42..eb461ebfdf14 100644 --- a/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py +++ b/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py @@ -48,7 +48,7 @@ class MemoryCacheTestCase(TestBase): # Check the value of my_ints[0] is the same as set in main.cpp. line = self.res.GetOutput().splitlines()[100] - self.assertTrue(0x00000042 == int(line.split(':')[1], 0)) + self.assertEquals(0x00000042, int(line.split(':')[1], 0)) # Change the value of my_ints[0] in memory. self.runCmd("memory write -s 4 `&my_ints` AA") @@ -59,4 +59,4 @@ class MemoryCacheTestCase(TestBase): # Check the value of my_ints[0] have been updated correctly. line = self.res.GetOutput().splitlines()[100] - self.assertTrue(0x000000AA == int(line.split(':')[1], 0)) + self.assertEquals(0x000000AA, int(line.split(':')[1], 0)) |
