Commit to solve bug: String.delete gives a wrong result (http://ironruby.codeplex.com/workitem/5426)

Hi,

I committed in my fork a very small change to solve the bug which is in


The commit is in:

The problem was inside the range detector in the delete method.
When it finds a ‘-’ character, it assumes that the string is a range,
but
when you use the \ before the ‘-’ you are telling that the ‘-’ char is a
literal.

The change was in the File MutableStringOps.cs in the Delete Method.

This is my first contribution to IronRuby, so I don’t know if i’m
following
all the steps in the right order :), so, forgive me if i’m doing wrong
but I
followed the guides written in github wiki.

Shall I proceed with the pull request to main repository, or are you
going
to review the commit before?

Regards.
Roberto

I’ll take a look. Could you add some tests to the specs, unless there
already are some? Let me know if you have any questions.

Thanks,
Tomas

From: [email protected]
[mailto:[email protected]] On Behalf Of Roberto Perez
Sent: Wednesday, May 11, 2011 3:56 AM
To: [email protected]
Subject: [Ironruby-core] Commit to solve bug: String.delete gives a
wrong result (http://ironruby.codeplex.com/workitem/5426)

Hi,

I committed in my fork a very small change to solve the bug which is in
http://ironruby.codeplex.com/workitem/5426
The commit is in:
https://github.com/robjperez/main/commit/7d94882990bc80504a78c7ed9ea989e31b8e19ed

The problem was inside the range detector in the delete method.
When it finds a ‘-’ character, it assumes that the string is a range,
but when you use the \ before the ‘-’ you are telling that the ‘-’ char
is a literal.

The change was in the File MutableStringOps.cs in the Delete Method.

This is my first contribution to IronRuby, so I don’t know if i’m
following all the steps in the right order :), so, forgive me if i’m
doing wrong but I followed the guides written in github wiki.

Shall I proceed with the pull request to main repository, or are you
going to review the commit before?

Regards.
Roberto

Ok I’ll add some tests to check the functionality of this commit.

I was trying to add one, but i’m having some problems passing the same
“pattern string” due to the difference between ruby syntax and c# one.
(As
the tests are written in c#)

I’ll tell you as soon as I have the test done.

Cheers

On Wed, May 11, 2011 at 6:23 PM, Tomas M. <

I meant Ruby mspec tests located in
Languages\Ruby\Tests\mspec\rubyspec\core\string (for strings).
You might find they are already written but disabled. In that case
remove the corresponding entries from tags:
Languages\Ruby\Tests\mspec\ironruby-tags-19\core\string

You can find more on mspec here: https://github.com/rubyspec/mspec

Tomas

From: [email protected]
[mailto:[email protected]] On Behalf Of Roberto Perez
Sent: Wednesday, May 11, 2011 3:27 PM
To: [email protected]
Subject: Re: [Ironruby-core] Commit to solve bug: String.delete gives a
wrong result (http://ironruby.codeplex.com/workitem/5426)

Ok I’ll add some tests to check the functionality of this commit.

I was trying to add one, but i’m having some problems passing the same
“pattern string” due to the difference between ruby syntax and c# one.
(As the tests are written in c#)

I’ll tell you as soon as I have the test done.

Cheers

On Wed, May 11, 2011 at 6:23 PM, Tomas M.
<[email protected]mailto:[email protected]>
wrote:
I’ll take a look. Could you add some tests to the specs, unless there
already are some? Let me know if you have any questions.

Thanks,
Tomas

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Roberto Perez
Sent: Wednesday, May 11, 2011 3:56 AM
To: [email protected]mailto:[email protected]
Subject: [Ironruby-core] Commit to solve bug: String.delete gives a
wrong result (http://ironruby.codeplex.com/workitem/5426)

Hi,

I committed in my fork a very small change to solve the bug which is in
http://ironruby.codeplex.com/workitem/5426
The commit is in:
https://github.com/robjperez/main/commit/7d94882990bc80504a78c7ed9ea989e31b8e19ed

The problem was inside the range detector in the delete method.
When it finds a ‘-’ character, it assumes that the string is a range,
but when you use the \ before the ‘-’ you are telling that the ‘-’ char
is a literal.

The change was in the File MutableStringOps.cs in the Delete Method.

This is my first contribution to IronRuby, so I don’t know if i’m
following all the steps in the right order :), so, forgive me if i’m
doing wrong but I followed the guides written in github wiki.

Shall I proceed with the pull request to main repository, or are you
going to review the commit before?

Regards.
Roberto


http://zbutton.wordpress.com/
blog sobre programacin y tecnologa

Hi!

There was no test to check this problem so i added it to the spec file
in
this commit:
https://github.com/robjperez/main/commit/83f87a4ab1573511bb4de00a7b57c10ea441c5ee

I added this:
“he-lo”.delete(’-’’).should == “helo”
which fails in current version but is fixed in the commit I mailed
before.

In the tags file, there was no tag regarding this issue. There is a tag
regarding another excepcion with ranges, but I think it is not about
this
one.

Cheers
Roberto.

On Thu, May 12, 2011 at 12:54 AM, Tomas M. <