mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 14:34:39 +02:00
* range.c: Support for Range#size and Range#each.size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
34be3a5d90
commit
28d8bf902d
2 changed files with 29 additions and 1 deletions
|
@ -347,4 +347,12 @@ class TestRange < Test::Unit::TestCase
|
|||
assert !x.eql?(z)
|
||||
}
|
||||
end
|
||||
|
||||
def test_size
|
||||
assert_equal 42, (1..42).size
|
||||
assert_equal 41, (1...42).size
|
||||
assert_equal 6, (1...6.3).size
|
||||
assert_equal 5, (1.1...6).size
|
||||
assert_equal 42, (1..42).each.size
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue