summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-10-07 11:06:44 +0900
committerNobuyoshi Nakada <[email protected]>2024-10-07 11:06:44 +0900
commit773d140f65c1c8b726e107915bc003c186f38677 (patch)
treefd518d22df990ee1f91946830a7b4d5aad6744db /test
parentec526c61c937ea03c460c91b01552629d196695a (diff)
[Bug #20787] Check the separator in `IO#readline` as well as 3.2
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11811
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 1ca05ae362..a623fd1d15 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2002,6 +2002,14 @@ class TestIO < Test::Unit::TestCase
end
end
+ def test_readline_incompatible_rs
+ first_line = File.open(__FILE__, &:gets).encode("utf-32le")
+ File.open(__FILE__, encoding: "utf-8:utf-32le") {|f|
+ assert_equal first_line, f.readline
+ assert_raise(ArgumentError) {f.readline("\0")}
+ }
+ end
+
def test_set_lineno_readline
pipe(proc do |w|
w.puts "foo"