From 38b3da3f6021ed7863d01115d19e091714f09b5f Mon Sep 17 00:00:00 2001 From: Herwin Date: Sun, 10 Sep 2023 11:49:13 +0200 Subject: [PATCH] Add extra test for IO.new with internal_encoding keyword When providing a single encoding in the mode argument, the external encoding of the IO object is set to that encoding, the internal encoding is left blank. The ArgumentError in this case is a rather specific behaviour. --- core/io/shared/new.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/io/shared/new.rb b/core/io/shared/new.rb index cba5f33eb..01e08f511 100644 --- a/core/io/shared/new.rb +++ b/core/io/shared/new.rb @@ -324,6 +324,9 @@ -> { @io = IO.send(@method, @fd, 'w:ISO-8859-1', external_encoding: 'ISO-8859-1') }.should raise_error(ArgumentError) + -> { + @io = IO.send(@method, @fd, 'w:ISO-8859-1', internal_encoding: 'ISO-8859-1') + }.should raise_error(ArgumentError) -> { @io = IO.send(@method, @fd, 'w:ISO-8859-1:UTF-8', internal_encoding: 'ISO-8859-1') }.should raise_error(ArgumentError)