summaryrefslogtreecommitdiff
path: root/test/io/console
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-01-30 17:57:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-01-30 19:19:23 +0900
commitc2cb5b44639dca036e36ccdd9ac351ed9874e7e4 (patch)
tree9b52116b084e646319da9d75c19d61db27a604cf /test/io/console
parent2f54422d03d12ef34356e879669303a58cca1b33 (diff)
[ruby/io-console] Move the condition to omit outside the method
https://github.com/ruby/io-console/commit/8b9b5b611a
Diffstat (limited to 'test/io/console')
-rw-r--r--test/io/console/test_io_console.rb15
1 files changed, 8 insertions, 7 deletions
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'