From 78008d342e7bd31d706f6c71465505e912209a3c Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 1 May 2008 12:47:07 +0000 Subject: * test/ruby/test_parse.rb (TestParse::test_void_expr_stmts_value): shut up warning. * rational.c (nurat_to_f): no need for forceful warning when converting to float. overflow is a nature of float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ rational.c | 4 ++-- test/ruby/test_parse.rb | 5 +++++ test/ruby/test_regexp.rb | 4 ---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c3f42d8c4..6841574c6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu May 1 20:31:09 2008 Yukihiro Matsumoto + + * test/ruby/test_parse.rb (TestParse::test_void_expr_stmts_value): + shut up warning. + + * rational.c (nurat_to_f): no need for forceful warning when + converting to float. overflow is a nature of float values. + Thu May 1 16:10:21 2008 Nobuyoshi Nakada * hash.c (env_delete_if): return enumerator if no block given. diff --git a/rational.c b/rational.c index 82cb0298a5..a81ffe1611 100644 --- a/rational.c +++ b/rational.c @@ -1130,7 +1130,7 @@ nurat_to_f(VALUE self) e = (int)(ne - de); if ((e > DBL_MAX_EXP) || (e < DBL_MIN_EXP)) { - rb_warn("%s out of Float range", rb_obj_classname(self)); + rb_warning("%s out of Float range", rb_obj_classname(self)); return rb_float_new(e > 0 ? HUGE_VAL : 0.0); } @@ -1140,7 +1140,7 @@ nurat_to_f(VALUE self) f = ldexp(f, e); if (isinf(f) || isnan(f)) - rb_warn("%s out of Float range", rb_obj_classname(self)); + rb_warning("%s out of Float range", rb_obj_classname(self)); return rb_float_new(f); } diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index bb7d662811..c02ad38f5a 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1,4 +1,5 @@ require 'test/unit' +require 'stringio' class TestParse < Test::Unit::TestCase def setup @@ -762,6 +763,8 @@ x = __ENCODING__ # This test checks if void contexts are warned correctly. # Thus, warnings MUST NOT be suppressed. $VERBOSE = true + stderr = $stderr + $stderr = StringIO.new("") x = 1 assert_nil eval("x; nil") assert_nil eval("1+1; nil") @@ -785,6 +788,8 @@ x = __ENCODING__ x = def o.foo; end END end + assert_equal($stderr.string.lines.to_a.size, 14) + $stderr = stderr end def test_assign_in_conditional diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 45ca220529..17fe9fa45f 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -250,10 +250,6 @@ class TestRegexp < Test::Unit::TestCase assert_equal(["foo", "bar", "baz"], m.values_at(1, 2, 3)) end - def test_match_select - assert_equal(["ab", "a", "b"], /(.)(.)/.match("ab").select {|v| true }, "[ruby-dev:34556]") - end - def test_match_string m = /(?b..)/.match("foobarbaz") assert_equal("foobarbaz", m.string) -- cgit v1.2.3