[Lldb-commits] [lldb] r373051 - [lldb][NFC] Actually test which method we call in TestCallOverriddenMethod

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 27 01:21:08 PDT 2019


Author: teemperor
Date: Fri Sep 27 01:21:08 2019
New Revision: 373051

URL: http://llvm.org/viewvc/llvm-project?rev=373051&view=rev
Log:
[lldb][NFC] Actually test which method we call in TestCallOverriddenMethod

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
    lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py?rev=373051&r1=373050&r2=373051&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py Fri Sep 27 01:21:08 2019
@@ -40,9 +40,12 @@ class ExprCommandCallOverriddenMethod(Te
 
         # Test call to method in base class (this should always work as the base
         # class method is never an override).
-        self.expect("expr b->foo()")
+        self.expect("expr b->foo()", substrs=["2"])
 
         # Test call to overridden method in derived class (this will fail if the
         # overrides table is not correctly set up, as Derived::foo will be assigned
         # a vtable entry that does not exist in the compiled program).
-        self.expect("expr d.foo()")
+        self.expect("expr d.foo()", substrs=["2"])
+
+        # Test calling the base class.
+        self.expect("expr realbase.foo()", substrs=["1"])

Modified: lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp?rev=373051&r1=373050&r2=373051&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp Fri Sep 27 01:21:08 2019
@@ -1,15 +1,16 @@
 class Base {
 public:
   virtual ~Base() {}
-  virtual void foo() {}
+  virtual int foo() { return 1; }
 };
 
 class Derived : public Base {
 public:
-  virtual void foo() {}
+  virtual int foo() { return 2; }
 };
 
 int main() {
+  Base realbase;
   Derived d;
   Base *b = &d;
   return 0; // Set breakpoint here




More information about the lldb-commits mailing list