From c2cb5b44639dca036e36ccdd9ac351ed9874e7e4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 30 Jan 2024 17:57:23 +0900 Subject: [ruby/io-console] Move the condition to omit outside the method https://github.com/ruby/io-console/commit/8b9b5b611a --- test/io/console/test_io_console.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb index fd0e57b8a5..3cc15b3277 100644 --- a/test/io/console/test_io_console.rb +++ b/test/io/console/test_io_console.rb @@ -36,19 +36,20 @@ class TestIO_Console < Test::Unit::TestCase trap(:TTOU, @old_ttou) if defined?(@old_ttou) and @old_ttou end + exceptions = %w[ENODEV ENOTTY EBADF ENXIO].map {|e| + Errno.const_get(e) if Errno.const_defined?(e) + } + exceptions.compact! + FailedPathExceptions = (exceptions unless exceptions.empty?) + def test_failed_path - exceptions = %w[ENODEV ENOTTY EBADF ENXIO].map {|e| - Errno.const_get(e) if Errno.const_defined?(e) - } - exceptions.compact! - omit if exceptions.empty? File.open(IO::NULL) do |f| - e = assert_raise(*exceptions) do + e = assert_raise(*FailedPathExceptions) do f.echo? end assert_include(e.message, IO::NULL) end - end + end if FailedPathExceptions def test_bad_keyword omit if RUBY_ENGINE == 'jruby' -- cgit v1.2.3