summaryrefslogtreecommitdiff
path: root/test/csv/test_table.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-25 06:49:59 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-25 06:49:59 +0000
commit24b57b102c1992b679f8f8c0fd1a0239289a129b (patch)
treee25055dbfcef70d3b01855c004e57e130b3fac5f /test/csv/test_table.rb
parentcdca14e75e98e2657daa40589f18a0ad46846020 (diff)
Upgrade CSV to 3.0.4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv/test_table.rb')
-rwxr-xr-xtest/csv/test_table.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb
index c341f17fc4..50edc77e40 100755
--- a/test/csv/test_table.rb
+++ b/test/csv/test_table.rb
@@ -1,14 +1,9 @@
-#!/usr/bin/env ruby -w
-# encoding: UTF-8
+# -*- coding: utf-8 -*-
# frozen_string_literal: false
-# tc_table.rb
-#
-# Created by James Edward Gray II on 2005-10-31.
+require_relative "helper"
-require_relative "base"
-
-class TestCSV::Table < TestCSV
+class TestCSVTable < Test::Unit::TestCase
extend DifferentOFS
def setup
@@ -21,7 +16,7 @@ class TestCSV::Table < TestCSV
@header_table = CSV::Table.new(
[CSV::Row.new(%w{A B C}, %w{A B C}, true)] + @rows
)
-
+
@header_only_table = CSV::Table.new([], headers: %w{A B C})
end
@@ -69,6 +64,13 @@ class TestCSV::Table < TestCSV
assert_equal(%w[A B C], @header_only_table.headers)
end
+ def test_headers_modified_by_row
+ table = CSV::Table.new([], headers: ["A", "B"])
+ table << ["a", "b"]
+ table.first << {"C" => "c"}
+ assert_equal(["A", "B", "C"], table.headers)
+ end
+
def test_index
##################
### Mixed Mode ###