dbremner / rubydotnetcompiler

Automatically exported from code.google.com/p/rubydotnetcompiler
0 stars 0 forks source link

string gsub bug - with suggested fix #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
puts "ABC vt100 DEF".gsub(/vt100/, 'VT100')

*should get* "ABC VT100 DEF"
*actual get* "ABC V DEF"

What version of the product are you using? On what operating system?
- latest svn 9th Jan 2008

Flaw seems to be line 1173 in string.cs.:
  //dest.Append(val.value.Substring(beg, val.value.Length - 
str.value.Length + 1));

Suggested (tested) fix replaces this with:
  dest.Append(val.value.Substring(beg, match.value.Length + 
val.value.Length - str.value.Length));

NOTE: the "while/until" test in test.rb is only passing
because of this bug. When it is fixed, the test fails
because of a different bug which I will log next (Hint -
gsub(/vt100/, 'VT100') changes both 'line' and $_)

Original issue reported on code.google.com by djl.rif...@googlemail.com on 9 Jan 2008 at 11:53

GoogleCodeExporter commented 8 years ago
Fixed in source code. 

Original comment by djl.rif...@googlemail.com on 23 Mar 2008 at 5:01