From b3a0c4d7dcfa252be17ef5f5b63ffaaa83e01a2b Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 13 Feb 2020 13:40:22 +0100 Subject: [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 --- .../API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lldb/test/API/functionalities/plugins/python_os_plugin') diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py index 5c4b42084c2c..64c640c38e7d 100644 --- a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -191,5 +191,5 @@ class PluginPythonOSPlugin(TestBase): self.assertTrue( line_entry.GetFileSpec().GetFilename() == 'main.c', "Make sure we stepped from line 5 to line 6 in main.c") - self.assertTrue(line_entry.GetLine() == 6, + self.assertEquals(line_entry.GetLine(), 6, "Make sure we stepped from line 5 to line 6 in main.c") -- cgit v1.2.3