Skip to content
Permalink
Browse files

Merge pull request #770 from kostya/append

fix string concat
  • Loading branch information
alex committed Jun 25, 2013
2 parents eb123cf + 0fae03e commit 96d0242c6d91973a44884b221d44d756ba70bdf7
@@ -1 +1,17 @@
fails:String#<<
fails:String#<< with Integer concatencates the argument interpreted as a codepoint
fails:String#<< with Integer returns a ASCII-8BIT string if self is US-ASCII and the argument is between 128-255 (inclusive)
fails:String#<< with Integer raises RangeError if the argument is an invalid codepoint for self's encoding
fails:String#<< with Integer raises RangeError if the argument is negative
fails:String#<< when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses self's encoding if both are empty
fails:String#<< when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses self's encoding if the argument is empty
fails:String#<< when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses the argument's encoding if self is empty
fails:String#<< when self is in an ASCII-incompatible encoding incompatible with the argument's encoding raises Encoding::CompatibilityError if neither are empty
fails:String#<< when the argument is in an ASCII-incompatible encoding incompatible with self's encoding uses self's encoding if both are empty
fails:String#<< when the argument is in an ASCII-incompatible encoding incompatible with self's encoding uses self's encoding if the argument is empty
fails:String#<< when the argument is in an ASCII-incompatible encoding incompatible with self's encoding uses the argument's encoding if self is empty
fails:String#<< when the argument is in an ASCII-incompatible encoding incompatible with self's encoding raises Encoding::CompatibilityError if neither are empty
fails:String#<< when self and the argument are in different ASCII-compatible encodings uses self's encoding if both are ASCII-only
fails:String#<< when self and the argument are in different ASCII-compatible encodings uses self's encoding if the argument is ASCII-only
fails:String#<< when self and the argument are in different ASCII-compatible encodings uses the argument's encoding if self is ASCII-only
fails:String#<< when self and the argument are in different ASCII-compatible encodings raises Encoding::CompatibilityError if neither are ASCII-only
fails:String#<< when self is ASCII-8BIT and argument is US-ASCII uses ASCII-8BIT encoding
@@ -1,12 +1,7 @@
fails:String#concat converts the given argument to a String using to_str
fails:String#concat raises a TypeError if the given argument can't be converted to a String
fails:String#concat taints self if other is tainted
fails:String#concat untrusts self if other is untrusted
fails:String#concat with Integer concatencates the argument interpreted as a codepoint
fails:String#concat with Integer returns a ASCII-8BIT string if self is US-ASCII and the argument is between 128-255 (inclusive)
fails:String#concat with Integer raises RangeError if the argument is an invalid codepoint for self's encoding
fails:String#concat with Integer raises RangeError if the argument is negative
fails:String#concat with Integer doesn't call to_int on its argument
fails:String#concat when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses self's encoding if both are empty
fails:String#concat when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses self's encoding if the argument is empty
fails:String#concat when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses the argument's encoding if self is empty
@@ -1,4 +1,3 @@
fails:String#+ taints the result when self or other is tainted
fails:String#+ when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses self's encoding if both are empty
fails:String#+ when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses self's encoding if the argument is empty
fails:String#+ when self is in an ASCII-incompatible encoding incompatible with the argument's encoding uses the argument's encoding if self is empty
@@ -466,15 +466,14 @@ def method_inspect(self, space):

@classdef.method("+")
def method_plus(self, space, w_obj):
if space.is_kind_of(w_obj, space.w_string):
w_other = w_obj
else:
w_other = space.convert_type(w_obj, space.w_string, "to_str")
w_other = space.convert_type(w_obj, space.w_string, "to_str")
assert isinstance(w_other, W_StringObject)
total_size = self.length() + w_other.length()
s = space.newstr_fromchars(newlist_hint(total_size))
s.extend(space, self)
s.extend(space, w_other)
space.infect(s, self)
space.infect(s, w_other)
return s

@classdef.method("*", times="int")
@@ -489,8 +488,13 @@ def method_times(self, space, times):
@classdef.method("concat")
@check_frozen()
def method_lshift(self, space, w_other):
if space.is_kind_of(w_other, space.w_fixnum):
w_other = space.send(w_other, "chr")
else:
w_other = space.convert_type(w_other, space.w_string, "to_str")
assert isinstance(w_other, W_StringObject)
self.extend(space, w_other)
space.infect(self, w_other)
return self

@classdef.method("bytesize")

0 comments on commit 96d0242

Please sign in to comment.
You can’t perform that action at this time.