kastiglione updated this revision to Diff 435972.
kastiglione added a comment.

add test/API/sanity/TestReprStrEquality.py


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


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/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

Reply via email to