1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/envutil.rb (EnvUtil#.suppress_warning): added.

* test/ruby/test_float.rb (TestFloat#test_Float): suppress
  warnings under --verbose.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-07-24 20:26:34 +00:00
parent b2d009fc7b
commit 8d3bb806b0
4 changed files with 24 additions and 6 deletions

View file

@ -1,3 +1,10 @@
Sun Jul 25 05:26:23 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ruby/envutil.rb (EnvUtil#.suppress_warning): added.
* test/ruby/test_float.rb (TestFloat#test_Float): suppress
warnings under --verbose.
Fri Jul 23 16:07:32 2010 Shugo Maeda <shugo@ruby-lang.org>
* lib/mutex_m.rb (sleep): added Mutex_m#sleep to support

View file

@ -100,6 +100,14 @@ module EnvUtil
end
module_function :verbose_warning
def suppress_warning
verbose, $VERBOSE = $VERBOSE, nil
yield
ensure
$VERBOSE = verbose
end
module_function :suppress_warning
def under_gc_stress
stress, GC.stress = GC.stress, true
yield
@ -114,7 +122,7 @@ module Test
module Assertions
public
def assert_normal_exit(testsrc, message = '', opt = {})
stdout, stderr, status = EnvUtil.invoke_ruby(%W'-W0', testsrc, true, true, opt)
_, _, status = EnvUtil.invoke_ruby(%W'-W0', testsrc, true, true, opt)
pid = status.pid
faildesc = proc do
signo = status.termsig
@ -161,7 +169,7 @@ module Test
end
def assert_ruby_status(args, test_stdin="", message=nil, opt={})
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, false, false, opt)
_, _, status = EnvUtil.invoke_ruby(args, test_stdin, false, false, opt)
m = message ? "#{message} (#{status.inspect})" : "ruby exit status is not success: #{status.inspect}"
assert(status.success?, m)
end

View file

@ -1,6 +1,9 @@
require 'test/unit'
require_relative 'envutil'
class TestFloat < Test::Unit::TestCase
include EnvUtil
def test_float
assert_equal(2, 2.6.floor)
assert_equal(-3, (-2.6).floor)
@ -426,10 +429,10 @@ class TestFloat < Test::Unit::TestCase
def test_Float
assert_in_delta(0.125, Float("0.1_2_5"), 0.00001)
assert_in_delta(0.125, "0.1_2_5__".to_f, 0.00001)
assert_equal(1, Float(([1] * 10000).join).infinite?)
assert_equal(1, suppress_warning {Float(([1] * 10000).join)}.infinite?)
assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK?
assert_raise(ArgumentError) { Float("1.0\x001") }
assert_equal(1, Float("1e10_00").infinite?)
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
assert_raise(TypeError) { Float(nil) }
o = Object.new
def o.to_f; inf = Float::INFINITY; inf/inf; end

View file

@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
#define RUBY_RELEASE_DATE "2010-07-24"
#define RUBY_RELEASE_DATE "2010-07-25"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
@ -8,7 +8,7 @@
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 7
#define RUBY_RELEASE_DAY 24
#define RUBY_RELEASE_DAY 25
#include "ruby/version.h"