summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-01-02 11:41:57 +0900
committerGitHub <[email protected]>2019-01-02 11:41:57 +0900
commit3e59f25eef8faf2677071dfc1add7142e92549e7 (patch)
tree329d9628abd66af133948435d7c51807598ead41
parent4ffc280372c1e769e271ff9e34d8dace8c9280ac (diff)
parentff0ab552d0f44c62ea9852f12353b9a6de5ab7d9 (diff)
downloadmruby-3e59f25eef8faf2677071dfc1add7142e92549e7.tar.gz
mruby-3e59f25eef8faf2677071dfc1add7142e92549e7.zip
Merge pull request #4208 from shuujii/io-skip-tty-test
io: Skip TTY test for environments that TTY device is unavailable.
-rw-r--r--mrbgems/mruby-io/test/io.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/mrbgems/mruby-io/test/io.rb b/mrbgems/mruby-io/test/io.rb
index 48a74f31e..e4a449696 100644
--- a/mrbgems/mruby-io/test/io.rb
+++ b/mrbgems/mruby-io/test/io.rb
@@ -344,15 +344,21 @@ end
assert('IO#isatty') do
skip "isatty is not supported on this platform" if MRubyIOTestUtil.win?
- f1 = File.open("/dev/tty")
- f2 = File.open($mrbtest_io_rfname)
-
- assert_true f1.isatty
- assert_false f2.isatty
-
- f1.close
- f2.close
- true
+ begin
+ f = File.open("/dev/tty")
+ rescue RuntimeError => e
+ skip e.message
+ else
+ assert_true f.isatty
+ ensure
+ f&.close
+ end
+ begin
+ f = File.open($mrbtest_io_rfname)
+ assert_false f.isatty
+ ensure
+ f&.close
+ end
end
assert('IO#pos=, IO#seek') do