aboutsummaryrefslogtreecommitdiffstats
path: root/test/csv/test_table.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/csv/test_table.rb')
-rwxr-xr-xtest/csv/test_table.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb
index ec710d30cc..44e9d4a8be 100755
--- a/test/csv/test_table.rb
+++ b/test/csv/test_table.rb
@@ -54,6 +54,11 @@ class TestCSV::Table < TestCSV
assert_equal(@rows.first.headers, @table.headers)
end
+ def test_headers_empty
+ t = CSV::Table.new([])
+ assert_equal Array.new, t.headers
+ end
+
def test_index
##################
### Mixed Mode ###
@@ -190,6 +195,14 @@ class TestCSV::Table < TestCSV
assert_raise(TypeError) { @table["Extra"] = nil }
end
+ def test_set_by_col_with_header_row
+ r = [ CSV::Row.new(%w{X Y Z}, [97, 98, 99], true) ]
+ t = CSV::Table.new(r)
+ t.by_col!
+ t['A'] = [42]
+ assert_equal(['A'], t['A'])
+ end
+
def test_each
######################
### Mixed/Row Mode ###