From 7e3b185a257213bc3c18e06a0ea648fbbdf937ae Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 5 Sep 2014 09:34:38 +0000 Subject: [PATCH] * test/csv/test_row.rb: Added some missing tests in CSV. * test/csv/test_table.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/csv/test_row.rb | 5 +++++ test/csv/test_table.rb | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2131f37b24..1641cb3bb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 5 18:34:33 2014 Laurent Arnoud + + * test/csv/test_row.rb: Added some missing tests in CSV. + * test/csv/test_table.rb: ditto. + Fri Sep 5 12:57:52 2014 Tanaka Akira * process.c (has_privilege): Refine uid/gid check. diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb index d786f38cd4..3acceea234 100755 --- a/test/csv/test_row.rb +++ b/test/csv/test_row.rb @@ -347,4 +347,9 @@ class TestCSV::Row < TestCSV def test_can_be_compared_with_other_classes assert_not_nil(CSV::Row.new([ ], [ ]), "The row was nil") end + + def test_can_be_compared_when_not_a_row + r = @row == [] + assert_equal false, r + end end 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 ###