ruby-changes:4776
From: ko1@a...
Date: Fri, 2 May 2008 16:52:14 +0900 (JST)
Subject: [ruby-changes:4776] akr - Ruby:r16270 (trunk): add tests for and .
akr 2008-05-02 16:52:01 +0900 (Fri, 02 May 2008)
New Revision: 16270
Modified files:
trunk/test/ruby/test_range.rb
Log:
add tests for [ruby-dev:34557] and [ruby-dev:34558].
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_range.rb?r1=16270&r2=16269&diff_format=u
Index: test/ruby/test_range.rb
===================================================================
--- test/ruby/test_range.rb (revision 16269)
+++ test/ruby/test_range.rb (revision 16270)
@@ -147,6 +147,20 @@
a = []
(o1...o2).step(1) {|x| a << x }
assert_equal([o1], a)
+
+ assert_nothing_raised("[ruby-dev:34557]") { (0..2).step(0.5) {|x| } }
+
+ a = []
+ (0..2).step(0.5) {|x| a << x }
+ assert_equal([0, 0.5, 1.0, 1.5, 2.0], a)
+
+ a = []
+ (0x40000000..0x40000002).step(0.5) {|x| a << x }
+ assert_equal([1073741824, 1073741824.5, 1073741825.0, 1073741825.5, 1073741826], a)
+
+ o = Object.new
+ def o.to_int() 1 end
+ assert_nothing_raised("[ruby-dev:34558]") { (0..2).step(o) {|x| } }
end
def test_each
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/