diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-17 01:58:34 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-17 01:58:34 +0000 |
commit | 96fb819676d401871b7cefd261ea7182684d6ff4 (patch) | |
tree | 13e1ec6d009725037a71f557c4492d49609d0e05 /test | |
parent | e5471cbe631cf2cb7949b46d480f68affdc29790 (diff) | |
download | bundler-96fb819676d401871b7cefd261ea7182684d6ff4.tar.gz |
* lib/csv.rb: accept to use Range object for row selection.
[Feature #11267][ruby-dev:49091]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rwxr-xr-x | test/csv/test_row.rb | 3 | ||||
-rwxr-xr-x | test/csv/test_table.rb | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb index 3acceea234..a8aeb288fc 100755 --- a/test/csv/test_row.rb +++ b/test/csv/test_row.rb @@ -64,6 +64,9 @@ class TestCSV::Row < TestCSV # by index assert_equal(3, @row.field(2)) + # by range + assert_equal([2,3], @row.field(1..2)) + # missing assert_nil(@row.field("Missing")) assert_nil(@row.field(10)) diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb index 44e9d4a8be..7d2148c379 100755 --- a/test/csv/test_table.rb +++ b/test/csv/test_table.rb @@ -67,6 +67,9 @@ class TestCSV::Table < TestCSV @rows.each_index { |i| assert_equal(@rows[i], @table[i]) } assert_equal(nil, @table[100]) # empty row + # by row with Range + assert_equal([@table[1], @table[2]], @table[1..2]) + # by col @rows.first.headers.each do |header| assert_equal(@rows.map { |row| row[header] }, @table[header]) |