summaryrefslogtreecommitdiff
path: root/test/io/console/test_io_console.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/io/console/test_io_console.rb')
-rw-r--r--test/io/console/test_io_console.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 594553bbe6..a0f88b6f8b 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -148,9 +148,17 @@ class TestIO_Console < Test::Unit::TestCase
}
end
- def test_sync
- skip "Can't get console (because of there is no tty?)" unless IO.console
- assert(helper {IO.console.sync}, "console should be unbuffered")
+ if IO.console
+ def test_sync
+ assert(IO.console.sync, "console should be unbuffered")
+ end
+ else
+ def test_sync
+ r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", "p IO.console.class")
+ con = r.gets.chomp
+ Process.wait(pid)
+ assert_match("File", con)
+ end
end
private