diff options
author | Sutou Kouhei <kou@cozmixng.org> | 2019-10-12 14:03:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-12 14:03:21 +0900 |
commit | 92df7d98b62f48cf21cdec522f2e7b34380fd718 (patch) | |
tree | a0d169e177ebd5607caefa26cef90cc70df48232 /test/csv/parse/test_general.rb | |
parent | d6e68bb263e79cb802fa683d9c4139ddca2fd4f5 (diff) | |
download | ruby-92df7d98b62f48cf21cdec522f2e7b34380fd718.tar.gz |
Import CSV 3.1.2 (#2547)
Diffstat (limited to 'test/csv/parse/test_general.rb')
-rw-r--r-- | test/csv/parse/test_general.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/csv/parse/test_general.rb b/test/csv/parse/test_general.rb index f340921854..655bb26560 100644 --- a/test/csv/parse/test_general.rb +++ b/test/csv/parse/test_general.rb @@ -233,11 +233,21 @@ line,5,jkl assert_equal([["a"]], CSV.parse("a\r\n")) end + def test_seeked_string_io + input_with_bom = StringIO.new("\ufeffあ,い,う\r\na,b,c\r\n") + input_with_bom.read(3) + assert_equal([ + ["あ", "い", "う"], + ["a", "b", "c"], + ], + CSV.new(input_with_bom).each.to_a) + end + private - def assert_parse_errors_out(*args, **options) + def assert_parse_errors_out(data, **options) assert_raise(CSV::MalformedCSVError) do Timeout.timeout(0.2) do - CSV.parse(*args, **options) + CSV.parse(data, **options) fail("Parse didn't error out") end end |