mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 05:25:34 +02:00
Merge csv-3.2.6
This commit is contained in:
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
27
test/csv/test_patterns.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue