[前][次][番号順一覧][スレッド一覧]

ruby-changes:35324

From: hsbt <ko1@a...>
Date: Fri, 5 Sep 2014 18:34:47 +0900 (JST)
Subject: [ruby-changes:35324] hsbt:r47406 (trunk): * test/csv/test_row.rb: Added some missing tests in CSV.

hsbt	2014-09-05 18:34:38 +0900 (Fri, 05 Sep 2014)

  New Revision: 47406

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47406

  Log:
    * test/csv/test_row.rb: Added some missing tests in CSV.
    * test/csv/test_table.rb: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/test/csv/test_row.rb
    trunk/test/csv/test_table.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47405)
+++ ChangeLog	(revision 47406)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Sep  5 18:34:33 2014  Laurent Arnoud  <laurent@s...>
+
+	* 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  <akr@f...>
 
 	* process.c (has_privilege): Refine uid/gid check.
Index: test/csv/test_row.rb
===================================================================
--- test/csv/test_row.rb	(revision 47405)
+++ test/csv/test_row.rb	(revision 47406)
@@ -347,4 +347,9 @@ class TestCSV::Row < TestCSV https://github.com/ruby/ruby/blob/trunk/test/csv/test_row.rb#L347
   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
Index: test/csv/test_table.rb
===================================================================
--- test/csv/test_table.rb	(revision 47405)
+++ test/csv/test_table.rb	(revision 47406)
@@ -54,6 +54,11 @@ class TestCSV::Table < TestCSV https://github.com/ruby/ruby/blob/trunk/test/csv/test_table.rb#L54
     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 https://github.com/ruby/ruby/blob/trunk/test/csv/test_table.rb#L195
     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 ###

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]