From cc9bc145300d129f27ad3a4ce186d7b1e3068b88 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 9 May 2020 13:55:48 +0900 Subject: [ruby/io-console] Added test for failed path https://github.com/ruby/io-console/commit/06a540f9b4 --- test/io/console/test_io_console.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb index a02605dd1e..eb0bb22c39 100644 --- a/test/io/console/test_io_console.rb +++ b/test/io/console/test_io_console.rb @@ -29,6 +29,16 @@ class TestIO_Console < Test::Unit::TestCase def set_winsize_teardown trap(:TTOU, @old_ttou) if defined?(@old_ttou) and @old_ttou end + + def test_failed_path + skip unless Errno.const_defined?(:ENODEV) + File.open(IO::NULL) do |f| + e = assert_raise(Errno::ENODEV) do + f.echo? + end + assert_include(e.message, IO::NULL) + end + end end defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do -- cgit v1.2.3