[Lldb-commits] [lldb] r266389 - Added a testcase for defining and using a block in the expression parser.

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 14 17:05:51 PDT 2016


Author: spyffe
Date: Thu Apr 14 19:05:50 2016
New Revision: 266389

URL: http://llvm.org/viewvc/llvm-project?rev=266389&view=rev
Log:
Added a testcase for defining and using a block in the expression parser.

<rdar://problem/25738696>

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py?rev=266389&r1=266388&r2=266389&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py Thu Apr 14 19:05:50 2016
@@ -21,9 +21,8 @@ class BlocksTestCase(TestBase):
         # Find the line numbers to break at.
         self.lines.append(line_number('main.c', '// Set breakpoint 0 here.'))
         self.lines.append(line_number('main.c', '// Set breakpoint 1 here.'))
-    
-    @unittest2.expectedFailure("rdar://problem/10413887 - Call blocks in expressions")
-    def test_expr(self):
+
+    def launch_common(self):
         self.build()
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
@@ -35,6 +34,10 @@ class BlocksTestCase(TestBase):
             lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
 
         self.wait_for_breakpoint()
+    
+    @unittest2.expectedFailure("rdar://problem/10413887 - Call blocks in expressions")
+    def test_expr(self):
+        self.launch_common()
 
         self.expect("expression a + b", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 7"])
@@ -47,6 +50,13 @@ class BlocksTestCase(TestBase):
         # This should display correctly.
         self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 12"])
+
+    def test_define(self):
+        self.launch_common()
+
+        self.runCmd("expression int (^$add)(int, int) = ^int(int a, int b) { return a + b; };")
+
+        self.expect("expression $add(2,3)", VARIABLES_DISPLAYED_CORRECTLY, substrs = [" = 5"])
     
     def wait_for_breakpoint(self):
         if self.is_started == False:




More information about the lldb-commits mailing list