Commits

Jürgen Bömmels committed d188b00

Implement String equal

Comments (0)

Files changed (2)

     def __repr__(self):
         return "<W_String \"" + self.strval + "\">"
 
+    def equal(self, w_obj):
+        if not isinstance(w_obj, W_String):
+            return False
+        return self.strval == w_obj.strval
+
 _charname_to_char = {
     'space': ' ',
     'newline': '\n',

scheme/test/test_object.py

     w_str = W_String(str)
     assert str == w_str.to_string()
     assert w_str.to_repr() == r'''"\\ \\\\ \\' \" \\\""'''
+    str1 = "foobar"
+    w_str1 = W_String(str1)
+    str2 = "foo" + "bar"
+    w_str2 = W_String(str2)
+    assert w_str1.equal(w_str2)
 
 def test_char():
     c = 'x'