[Lldb-commits] [lldb] 9beba42 - [lldb][NFC] Modernize TestExprChar

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 1 04:24:41 PDT 2020


Author: Raphael Isemann
Date: 2020-04-01T13:24:21+02:00
New Revision: 9beba4245a77ae75db874146036b77fb76398e4c

URL: https://github.com/llvm/llvm-project/commit/9beba4245a77ae75db874146036b77fb76398e4c
DIFF: https://github.com/llvm/llvm-project/commit/9beba4245a77ae75db874146036b77fb76398e4c.diff

LOG: [lldb][NFC] Modernize TestExprChar

Added: 
    

Modified: 
    lldb/test/API/commands/expression/char/TestExprsChar.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/expression/char/TestExprsChar.py b/lldb/test/API/commands/expression/char/TestExprsChar.py
index f1fa78053846..a1a4568aa92e 100644
--- a/lldb/test/API/commands/expression/char/TestExprsChar.py
+++ b/lldb/test/API/commands/expression/char/TestExprsChar.py
@@ -1,44 +1,21 @@
-
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
 class ExprCharTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def setUp(self):
-        # Call super's setUp().
-        TestBase.setUp(self)
-
-        self.main_source = "main.cpp"
-        self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
     def do_test(self, dictionary=None):
         """These basic expression commands should work as expected."""
         self.build(dictionary=dictionary)
 
-        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
-                                          '// Break here', self.main_source_spec)
-        frame = thread.GetFrameAtIndex(0)
-
-        value = frame.EvaluateExpression("foo(c)")
-        self.assertTrue(value.IsValid())
-        self.assertTrue(value.GetError().Success())
-        self.assertEqual(value.GetValueAsSigned(0), 1)
-
-        value = frame.EvaluateExpression("foo(sc)")
-        self.assertTrue(value.IsValid())
-        self.assertTrue(value.GetError().Success())
-        self.assertEqual(value.GetValueAsSigned(0), 2)
+        lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp"))
 
-        value = frame.EvaluateExpression("foo(uc)")
-        self.assertTrue(value.IsValid())
-        self.assertTrue(value.GetError().Success())
-        self.assertEqual(value.GetValueAsSigned(0), 3)
+        self.expect_expr("foo(c)", result_value="1")
+        self.expect_expr("foo(sc)", result_value="2")
+        self.expect_expr("foo(uc)", result_value="3")
 
     def test_default_char(self):
         self.do_test()


        


More information about the lldb-commits mailing list