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

B5e8b84400b6903e4436e0489905e051?d=identicon&s=25 Roberto Perez (Guest)
on 2011-05-11 13:50
(Received via mailing list)
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/7d9488299...

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
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2011-05-11 18:46
(Received via mailing list)
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: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Roberto Perez
Sent: Wednesday, May 11, 2011 3:56 AM
To: ironruby-core@rubyforge.org
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/7d9488299...

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
B5e8b84400b6903e4436e0489905e051?d=identicon&s=25 Roberto Perez (Guest)
on 2011-05-12 00:51
(Received via mailing list)
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 Matousek <
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2011-05-12 01:05
(Received via mailing list)
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: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Roberto Perez
Sent: Wednesday, May 11, 2011 3:27 PM
To: ironruby-core@rubyforge.org
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 Matousek
<Tomas.Matousek@microsoft.com<mailto:Tomas.Matousek@microsoft.com>>
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:
ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>
[mailto:ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>]
On Behalf Of Roberto Perez
Sent: Wednesday, May 11, 2011 3:56 AM
To: ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org>
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/7d9488299...

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
B5e8b84400b6903e4436e0489905e051?d=identicon&s=25 Roberto Perez (Guest)
on 2011-05-13 21:42
(Received via mailing list)
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/83f87a4ab...

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 Matousek <
This topic is locked and can not be replied to.