ruby-changes:18022
From: yugui <ko1@a...>
Date: Thu, 2 Dec 2010 17:08:00 +0900 (JST)
Subject: [ruby-changes:18022] Ruby:r30045 (ruby_1_9_2): merges r29490 from trunk into ruby_1_9_2.
yugui 2010-12-02 17:07:24 +0900 (Thu, 02 Dec 2010) New Revision: 30045 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30045 Log: merges r29490 from trunk into ruby_1_9_2. -- * numeric.c (ruby_float_step): fix Numeric#step with infinity unit doesn't works well. [ruby-core:32779] Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/numeric.c branches/ruby_1_9_2/test/ruby/test_numeric.rb branches/ruby_1_9_2/test/ruby/test_string.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30044) +++ ruby_1_9_2/ChangeLog (revision 30045) @@ -1,3 +1,8 @@ +Thu Oct 14 04:16:41 2010 NARUSE, Yui <naruse@r...> + + * numeric.c (ruby_float_step): fix Numeric#step with infinity unit + doesn't works well. [ruby-core:32779] + Wed Oct 13 22:32:34 2010 Takeyuki FUJIOKA <xibbar@r...> * lib/cgi/util.rb (CGI::unescape): bugfix to unescape the multibyte Index: ruby_1_9_2/numeric.c =================================================================== --- ruby_1_9_2/numeric.c (revision 30044) +++ ruby_1_9_2/numeric.c (revision 30045) @@ -1576,7 +1576,7 @@ long i; if (isinf(unit)) { - if (unit > 0) rb_yield(DBL2NUM(beg)); + if (unit > 0 ? beg <= end : beg >= end) rb_yield(DBL2NUM(beg)); } else { if (err>0.5) err=0.5; Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30044) +++ ruby_1_9_2/version.h (revision 30045) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 75 +#define RUBY_PATCHLEVEL 76 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/ruby/test_string.rb =================================================================== --- ruby_1_9_2/test/ruby/test_string.rb (revision 30044) +++ ruby_1_9_2/test/ruby/test_string.rb (revision 30045) @@ -175,9 +175,11 @@ def o.<=>(x); nil; end assert_nil("foo" <=> o) + class << o;remove_method :<=>;end def o.<=>(x); 1; end assert_equal(-1, "foo" <=> o) + class << o;remove_method :<=>;end def o.<=>(x); 2**100; end assert_equal(-(2**100), "foo" <=> o) end @@ -200,6 +202,7 @@ def o.to_str; end def o.==(x); false; end assert_equal(false, "foo" == o) + class << o;remove_method :==;end def o.==(x); true; end assert_equal(true, "foo" == o) end @@ -1814,6 +1817,7 @@ c.class_eval { attr 1 } end + class << o;remove_method :to_str;end def o.to_str; "foo"; end assert_nothing_raised do c.class_eval { attr o } Index: ruby_1_9_2/test/ruby/test_numeric.rb =================================================================== --- ruby_1_9_2/test/ruby/test_numeric.rb (revision 30044) +++ ruby_1_9_2/test/ruby/test_numeric.rb (revision 30045) @@ -27,6 +27,7 @@ assert_raise(ArgumentError) { 1 <= a } DummyNumeric.class_eval do + remove_method :coerce def coerce(x); 1.coerce(x); end end assert_equal(2, 1 + a) @@ -34,6 +35,7 @@ assert(1 <= a) DummyNumeric.class_eval do + remove_method :coerce def coerce(x); [x, 1]; end end assert_equal(-1, -a) @@ -95,6 +97,7 @@ assert_equal(:ok, a.abs) DummyNumeric.class_eval do + remove_method :< def <(x); false; end end @@ -150,6 +153,7 @@ assert_equal(1, a.truncate) DummyNumeric.class_eval do + remove_method :to_f def to_f; 1.4; end end @@ -160,6 +164,7 @@ assert_equal(1, a.truncate) DummyNumeric.class_eval do + remove_method :to_f def to_f; -1.5; end end @@ -202,6 +207,14 @@ a = [] 10.step(1, -(2**32)) {|x| a << x } assert_equal([10], a) + + a = [] + 1.step(0, Float::INFINITY) {|x| a << x } + assert_equal([], a) + + a = [] + 0.step(1, -Float::INFINITY) {|x| a << x } + assert_equal([], a) end def test_num2long -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/