aboutsummaryrefslogtreecommitdiffstats
path: root/test/csv/parse/test_general.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/csv/parse/test_general.rb')
-rw-r--r--test/csv/parse/test_general.rb14
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