diff options
Diffstat (limited to 'test/io/console')
-rw-r--r-- | test/io/console/test_io_console.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb index 1368502b04..73c97a6ceb 100644 --- a/test/io/console/test_io_console.rb +++ b/test/io/console/test_io_console.rb @@ -12,6 +12,16 @@ end defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do Bug6116 = '[ruby-dev:45309]' + # FreeBSD seems to hang on TTOU when running parallel tests + # tested on FreeBSD 11.x + def set_winsize_setup + @old_ttou = trap(:TTOU, 'IGNORE') if RUBY_PLATFORM =~ /freebsd/i + end + + def set_winsize_teardown + trap(:TTOU, @old_ttou) if @old_ttou + end + def test_raw helper {|m, s| s.print "abc\n" @@ -255,6 +265,7 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do end def test_set_winsize_invalid_dev + set_winsize_setup [IO::NULL, __FILE__].each do |path| open(path) do |io| begin @@ -267,6 +278,8 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do assert_raise(ArgumentError) {io.winsize = [0, 0, 0]} end end + ensure + set_winsize_teardown end unless IO.console @@ -322,6 +335,7 @@ defined?(IO.console) and TestIO_Console.class_eval do end def test_set_winsize_console + set_winsize_setup s = IO.console.winsize assert_nothing_raised(TypeError) {IO.console.winsize = s} bug = '[ruby-core:82741] [Bug #13888]' @@ -329,6 +343,8 @@ defined?(IO.console) and TestIO_Console.class_eval do assert_equal([s[0], s[1]+1], IO.console.winsize, bug) IO.console.winsize = s assert_equal(s, IO.console.winsize, bug) + ensure + set_winsize_teardown end def test_close |