[Lldb-commits] [lldb] 6f19f98 - [lldb][Test] Replace expect() with expect_expr() in TestNamespaceLookup.py

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 22 05:28:03 PDT 2022


Author: Michael Buch
Date: 2022-08-22T13:22:19+01:00
New Revision: 6f19f98710f897ecaf148f42da6eec9d14631449

URL: https://github.com/llvm/llvm-project/commit/6f19f98710f897ecaf148f42da6eec9d14631449
DIFF: https://github.com/llvm/llvm-project/commit/6f19f98710f897ecaf148f42da6eec9d14631449.diff

LOG: [lldb][Test] Replace expect() with expect_expr() in TestNamespaceLookup.py

This will be useful in preparation for some reshuffling
of assertions in this file since we won't have to
adjust the persitent variable names during the process.

sed commands:
```
s/expect("expr -- /expect_expr("/g
s/startstr="(int) [$0-9]* = /result_type="int", result_value="/g
```

**Testing**

* API tests still pass

Differential Revision: https://reviews.llvm.org/D132271

Added: 
    

Modified: 
    lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
index 3a27278beae84..cf33919855d8c 100644
--- a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
+++ b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
@@ -82,60 +82,60 @@ def test_scope_lookup_with_run_command(self):
         # Run to BP_global_scope at global scope
         self.runToBkpt("run")
         # Evaluate func() - should call ::func()
-        self.expect("expr -- func()", startstr="(int) $0 = 1")
+        self.expect_expr("func()", result_type="int", result_value="1")
         # Evaluate A::B::func() - should call A::B::func()
-        self.expect("expr -- A::B::func()", startstr="(int) $1 = 4")
+        self.expect_expr("A::B::func()", result_type="int", result_value="4")
         # Evaluate func(10) - should call ::func(int)
-        self.expect("expr -- func(10)", startstr="(int) $2 = 11")
+        self.expect_expr("func(10)", result_type="int", result_value="11")
         # Evaluate ::func() - should call A::func()
-        self.expect("expr -- ::func()", startstr="(int) $3 = 1")
+        self.expect_expr("::func()", result_type="int", result_value="1")
         # Evaluate A::foo() - should call A::foo()
-        self.expect("expr -- A::foo()", startstr="(int) $4 = 42")
+        self.expect_expr("A::foo()", result_type="int", result_value="42")
 
         # Continue to BP_ns_scope at ns scope
         self.runToBkpt("continue")
         # Evaluate func(10) - should call A::func(int)
-        self.expect("expr -- func(10)", startstr="(int) $5 = 13")
+        self.expect_expr("func(10)", result_type="int", result_value="13")
         # Evaluate B::func() - should call B::func()
-        self.expect("expr -- B::func()", startstr="(int) $6 = 4")
+        self.expect_expr("B::func()", result_type="int", result_value="4")
         # Evaluate func() - should call A::func()
-        self.expect("expr -- func()", startstr="(int) $7 = 3")
+        self.expect_expr("func()", result_type="int", result_value="3")
 
         # Continue to BP_nested_ns_scope at nested ns scope
         self.runToBkpt("continue")
         # Evaluate func() - should call A::B::func()
-        self.expect("expr -- func()", startstr="(int) $8 = 4")
+        self.expect_expr("func()", result_type="int", result_value="4")
         # Evaluate A::func() - should call A::func()
-        self.expect("expr -- A::func()", startstr="(int) $9 = 3")
+        self.expect_expr("A::func()", result_type="int", result_value="3")
 
         # Evaluate func(10) - should call A::func(10)
         # NOTE: Under the rules of C++, this test would normally get an error
         # because A::B::func() hides A::func(), but lldb intentionally
         # disobeys these rules so that the intended overload can be found
         # by only removing duplicates if they have the same type.
-        self.expect("expr -- func(10)", startstr="(int) $10 = 13")
+        self.expect_expr("func(10)", result_type="int", result_value="13")
 
         # Continue to BP_nested_ns_scope_after_using at nested ns scope after
         # using declaration
         self.runToBkpt("continue")
         # Evaluate A::func(10) - should call A::func(int)
-        self.expect("expr -- A::func(10)", startstr="(int) $11 = 13")
+        self.expect_expr("A::func(10)", result_type="int", result_value="13")
 
         # Continue to BP_before_using_directive at global scope before using
         # declaration
         self.runToBkpt("continue")
         # Evaluate ::func() - should call ::func()
-        self.expect("expr -- ::func()", startstr="(int) $12 = 1")
+        self.expect_expr("::func()", result_type="int", result_value="1")
         # Evaluate B::func() - should call B::func()
-        self.expect("expr -- B::func()", startstr="(int) $13 = 4")
+        self.expect_expr("B::func()", result_type="int", result_value="4")
 
         # Continue to BP_after_using_directive at global scope after using
         # declaration
         self.runToBkpt("continue")
         # Evaluate ::func() - should call ::func()
-        self.expect("expr -- ::func()", startstr="(int) $14 = 1")
+        self.expect_expr("::func()", result_type="int", result_value="1")
         # Evaluate B::func() - should call B::func()
-        self.expect("expr -- B::func()", startstr="(int) $15 = 4")
+        self.expect_expr("B::func()", result_type="int", result_value="4")
 
     @expectedFailure("lldb scope lookup of functions bugs")
     def test_function_scope_lookup_with_run_command(self):
@@ -161,18 +161,18 @@ def test_function_scope_lookup_with_run_command(self):
         # Evaluate foo() - should call ::foo()
         # FIXME: lldb finds Y::foo because lookup for variables is done
         # before functions.
-        self.expect("expr -- foo()", startstr="(int) $0 = 42")
+        self.expect_expr("foo()", result_type="int", result_value="42")
         # Evaluate ::foo() - should call ::foo()
         # FIXME: lldb finds Y::foo because lookup for variables is done
         # before functions and :: is ignored.
-        self.expect("expr -- ::foo()", startstr="(int) $1 = 42")
+        self.expect_expr("::foo()", result_type="int", result_value="42")
 
         # Continue to BP_ns_scope at ns scope
         self.runToBkpt("continue")
         # Evaluate foo() - should call A::foo()
         # FIXME: lldb finds Y::foo because lookup for variables is done
         # before functions.
-        self.expect("expr -- foo()", startstr="(int) $2 = 42")
+        self.expect_expr("foo()", result_type="int", result_value="42")
 
     @expectedFailure("lldb file scope lookup bugs")
     @skipIfWindows # This is flakey on Windows: llvm.org/pr38373
@@ -193,7 +193,7 @@ def test_file_scope_lookup_with_run_command(self):
         # Evaluate func() - should call static ns2.cpp:func()
         # FIXME: This test fails because lldb doesn't know about file scopes so
         # finds the global ::func().
-        self.expect("expr -- func()", startstr="(int) $0 = 2")
+        self.expect_expr("func()", result_type="int", result_value="2")
 
     @skipIfWindows # This is flakey on Windows: llvm.org/pr38373
     def test_scope_lookup_before_using_with_run_command(self):
@@ -212,7 +212,7 @@ def test_scope_lookup_before_using_with_run_command(self):
         # declaration
         self.runToBkpt("run")
         # Evaluate func() - should call ::func()
-        self.expect("expr -- func()", startstr="(int) $0 = 1")
+        self.expect_expr("func()", result_type="int", result_value="1")
 
     # NOTE: this test may fail on older systems that don't emit import
     # entries in DWARF - may need to add checks for compiler versions here.
@@ -236,7 +236,7 @@ def test_scope_after_using_directive_lookup_with_run_command(self):
         # declaration
         self.runToBkpt("run")
         # Evaluate func2() - should call A::func2()
-        self.expect("expr -- func2()", startstr="(int) $0 = 3")
+        self.expect_expr("func2()", result_type="int", result_value="3")
 
     @expectedFailure(
         "lldb scope lookup after using declaration bugs")
@@ -258,7 +258,7 @@ def test_scope_after_using_declaration_lookup_with_run_command(self):
         # declaration
         self.runToBkpt("run")
         # Evaluate func() - should call A::func()
-        self.expect("expr -- func()", startstr="(int) $0 = 3")
+        self.expect_expr("func()", result_type="int", result_value="3")
 
     @expectedFailure("lldb scope lookup ambiguity after using bugs")
     def test_scope_ambiguity_after_using_lookup_with_run_command(self):
@@ -300,4 +300,4 @@ def test_scope_lookup_shadowed_by_using_with_run_command(self):
         # because A::B::func() shadows A::func(), but lldb intentionally
         # disobeys these rules so that the intended overload can be found
         # by only removing duplicates if they have the same type.
-        self.expect("expr -- func(10)", startstr="(int) $0 = 13")
+        self.expect_expr("func(10)", result_type="int", result_value="13")


        


More information about the lldb-commits mailing list