aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-05-20 11:57:52 +0200
committerRaphael Isemann <teemperor@gmail.com>2020-05-20 12:27:44 +0200
commit4bee2afcd7ea10c9f58f6172924f822849fed8f9 (patch)
tree88e8e36a2b791b09ac3807f14574ca326b6f6fe0
parentaafdeeade8de2fda03b046dc8906bf4d4f4539f0 (diff)
downloadllvm-4bee2afcd7ea10c9f58f6172924f822849fed8f9.zip
llvm-4bee2afcd7ea10c9f58f6172924f822849fed8f9.tar.gz
llvm-4bee2afcd7ea10c9f58f6172924f822849fed8f9.tar.bz2
[lldb][NFC] Modernize TestCPPStaticMethods
Now with LLVM code style and expect_expr for checking. Also some minor changes to be more similar to the structure we use in other tests.
-rw-r--r--lldb/test/API/lang/cpp/static_methods/TestCPPStaticMethods.py9
-rw-r--r--lldb/test/API/lang/cpp/static_methods/main.cpp28
2 files changed, 9 insertions, 28 deletions
diff --git a/lldb/test/API/lang/cpp/static_methods/TestCPPStaticMethods.py b/lldb/test/API/lang/cpp/static_methods/TestCPPStaticMethods.py
index d358757..ee4cc60 100644
--- a/lldb/test/API/lang/cpp/static_methods/TestCPPStaticMethods.py
+++ b/lldb/test/API/lang/cpp/static_methods/TestCPPStaticMethods.py
@@ -15,10 +15,7 @@ class CPPStaticMethodsTestCase(TestBase):
def test_with_run_command(self):
"""Test that static methods are properly distinguished from regular methods"""
self.build()
- lldbutil.run_to_source_breakpoint(self, "// Break at this line", lldb.SBFileSpec("main.cpp"))
+ lldbutil.run_to_source_breakpoint(self, "// Break here", lldb.SBFileSpec("main.cpp"))
- self.expect("expression -- A::getStaticValue()",
- startstr="(int) $0 = 5")
-
- self.expect("expression -- my_a.getMemberValue()",
- startstr="(int) $1 = 3")
+ self.expect_expr("A::getStaticValue()", result_type="int", result_value="5")
+ self.expect_expr("a.getMemberValue()", result_type="int", result_value="3")
diff --git a/lldb/test/API/lang/cpp/static_methods/main.cpp b/lldb/test/API/lang/cpp/static_methods/main.cpp
index de1c2ff..332fca62f 100644
--- a/lldb/test/API/lang/cpp/static_methods/main.cpp
+++ b/lldb/test/API/lang/cpp/static_methods/main.cpp
@@ -1,29 +1,13 @@
-#include <stdio.h>
-
-class A
-{
+struct A {
public:
- static int getStaticValue();
- int getMemberValue();
+ static int getStaticValue() { return 5; }
+ int getMemberValue() { return a; }
int a;
};
-int A::getStaticValue()
-{
- return 5;
-}
-
-int A::getMemberValue()
-{
- return a;
-}
-
int main()
{
- A my_a;
-
- my_a.a = 3;
-
- printf("%d\n", A::getStaticValue()); // Break at this line
- printf("%d\n", my_a.getMemberValue());
+ A a;
+ a.a = 3;
+ return A::getStaticValue() + a.getMemberValue(); // Break here
}