kastiglione updated this revision to Diff 435980. kastiglione added a comment.
update TestConvenienceVariables.test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127458/new/ https://reviews.llvm.org/D127458 Files: lldb/bindings/macros.swig lldb/test/API/sanity/TestReprStrEquality.py lldb/test/Shell/Driver/Inputs/convenience.in lldb/test/Shell/Driver/TestConvenienceVariables.test Index: lldb/test/Shell/Driver/TestConvenienceVariables.test =================================================================== --- lldb/test/Shell/Driver/TestConvenienceVariables.test +++ lldb/test/Shell/Driver/TestConvenienceVariables.test @@ -6,10 +6,16 @@ CHECK: stop reason = breakpoint 1.1 CHECK: script print(lldb.debugger) CHECK-NEXT: Debugger (instance: {{.*}}, id: {{[0-9]+}}) +CHECK: script lldb.debugger +CHECK-NEXT: Debugger (instance: {{.*}}, id: {{[0-9]+}}) CHECK: script print(lldb.target) CHECK-NEXT: target.out +CHECK: script lldb.target +CHECK-NEXT: target.out CHECK: script print(lldb.process) CHECK-NEXT: SBProcess: pid = {{[0-9]+}}, state = stopped, threads = {{[0-9]+}}, executable = target.out +CHECK: script lldb.process +CHECK-NEXT: SBProcess: pid = {{[0-9]+}}, state = stopped, threads = {{[0-9]+}}, executable = target.out CHECK: script print(lldb.thread.GetStopDescription(100)) CHECK-NEXT: breakpoint 1.1 CHECK: script lldb.frame.GetLineEntry().GetLine() Index: lldb/test/Shell/Driver/Inputs/convenience.in =================================================================== --- lldb/test/Shell/Driver/Inputs/convenience.in +++ lldb/test/Shell/Driver/Inputs/convenience.in @@ -1,8 +1,11 @@ breakpoint set -f hello.cpp -p Hello run script print(lldb.debugger) +script lldb.debugger script print(lldb.target) +script lldb.target script print(lldb.process) +script lldb.process script print(lldb.thread.GetStopDescription(100)) script lldb.frame.GetLineEntry().GetLine() script lldb.frame.GetLineEntry().GetFileSpec().GetFilename() Index: lldb/test/API/sanity/TestReprStrEquality.py =================================================================== --- /dev/null +++ lldb/test/API/sanity/TestReprStrEquality.py @@ -0,0 +1,18 @@ +""" +This is a sanity check that verifies that `repr(sbobject)` and `str(sbobject)` +produce the same string. +""" + + +import lldb +from lldbsuite.test.lldbtest import * + + +class TestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + NO_DEBUG_INFO_TESTCASE = True + + def test(self): + self.assertEqual(repr(self.dbg), str(self.dbg)) Index: lldb/bindings/macros.swig =================================================================== --- lldb/bindings/macros.swig +++ lldb/bindings/macros.swig @@ -1,6 +1,6 @@ %define STRING_EXTENSION_LEVEL(Class, Level) %extend { - std::string lldb:: ## Class ## ::__str__(){ + std::string lldb:: ## Class ## ::__repr__(){ lldb::SBStream stream; $self->GetDescription (stream, Level); const char *desc = stream.GetData(); @@ -15,7 +15,7 @@ %define STRING_EXTENSION(Class) %extend { - std::string lldb:: ## Class ## ::__str__(){ + std::string lldb:: ## Class ## ::__repr__(){ lldb::SBStream stream; $self->GetDescription (stream); const char *desc = stream.GetData();
Index: lldb/test/Shell/Driver/TestConvenienceVariables.test =================================================================== --- lldb/test/Shell/Driver/TestConvenienceVariables.test +++ lldb/test/Shell/Driver/TestConvenienceVariables.test @@ -6,10 +6,16 @@ CHECK: stop reason = breakpoint 1.1 CHECK: script print(lldb.debugger) CHECK-NEXT: Debugger (instance: {{.*}}, id: {{[0-9]+}}) +CHECK: script lldb.debugger +CHECK-NEXT: Debugger (instance: {{.*}}, id: {{[0-9]+}}) CHECK: script print(lldb.target) CHECK-NEXT: target.out +CHECK: script lldb.target +CHECK-NEXT: target.out CHECK: script print(lldb.process) CHECK-NEXT: SBProcess: pid = {{[0-9]+}}, state = stopped, threads = {{[0-9]+}}, executable = target.out +CHECK: script lldb.process +CHECK-NEXT: SBProcess: pid = {{[0-9]+}}, state = stopped, threads = {{[0-9]+}}, executable = target.out CHECK: script print(lldb.thread.GetStopDescription(100)) CHECK-NEXT: breakpoint 1.1 CHECK: script lldb.frame.GetLineEntry().GetLine() Index: lldb/test/Shell/Driver/Inputs/convenience.in =================================================================== --- lldb/test/Shell/Driver/Inputs/convenience.in +++ lldb/test/Shell/Driver/Inputs/convenience.in @@ -1,8 +1,11 @@ breakpoint set -f hello.cpp -p Hello run script print(lldb.debugger) +script lldb.debugger script print(lldb.target) +script lldb.target script print(lldb.process) +script lldb.process script print(lldb.thread.GetStopDescription(100)) script lldb.frame.GetLineEntry().GetLine() script lldb.frame.GetLineEntry().GetFileSpec().GetFilename() Index: lldb/test/API/sanity/TestReprStrEquality.py =================================================================== --- /dev/null +++ lldb/test/API/sanity/TestReprStrEquality.py @@ -0,0 +1,18 @@ +""" +This is a sanity check that verifies that `repr(sbobject)` and `str(sbobject)` +produce the same string. +""" + + +import lldb +from lldbsuite.test.lldbtest import * + + +class TestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + NO_DEBUG_INFO_TESTCASE = True + + def test(self): + self.assertEqual(repr(self.dbg), str(self.dbg)) Index: lldb/bindings/macros.swig =================================================================== --- lldb/bindings/macros.swig +++ lldb/bindings/macros.swig @@ -1,6 +1,6 @@ %define STRING_EXTENSION_LEVEL(Class, Level) %extend { - std::string lldb:: ## Class ## ::__str__(){ + std::string lldb:: ## Class ## ::__repr__(){ lldb::SBStream stream; $self->GetDescription (stream, Level); const char *desc = stream.GetData(); @@ -15,7 +15,7 @@ %define STRING_EXTENSION(Class) %extend { - std::string lldb:: ## Class ## ::__str__(){ + std::string lldb:: ## Class ## ::__repr__(){ lldb::SBStream stream; $self->GetDescription (stream); const char *desc = stream.GetData();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits