Merge csv-3.2.6

This commit is contained in:
Hiroshi SHIBATA 2022-12-09 08:46:14 +09:00
parent 260a00d80e
commit 643918ecfe
Notes: git 2022-12-09 07:36:49 +00:00
20 changed files with 1759 additions and 425 deletions

27
test/csv/test_patterns.rb Normal file
View file

@ -0,0 +1,27 @@
# frozen_string_literal: true
require_relative "helper"
class TestCSVPatternMatching < Test::Unit::TestCase
def test_hash
case CSV::Row.new(%i{A B C}, [1, 2, 3])
in B: b, C: c
assert_equal([2, 3], [b, c])
end
end
def test_hash_rest
case CSV::Row.new(%i{A B C}, [1, 2, 3])
in B: b, **rest
assert_equal([2, { A: 1, C: 3 }], [b, rest])
end
end
def test_array
case CSV::Row.new(%i{A B C}, [1, 2, 3])
in *, matched
assert_equal(3, matched)
end
end
end