ruby-changes:52032
From: normal <ko1@a...>
Date: Thu, 9 Aug 2018 18:02:39 +0900 (JST)
Subject: [ruby-changes:52032] normal:r64248 (trunk): test/io/console/test_io_console.rb: fix short read failures
normal 2018-08-09 18:02:32 +0900 (Thu, 09 Aug 2018) New Revision: 64248 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64248 Log: test/io/console/test_io_console.rb: fix short read failures Running with TESTS=--no-retry, I sometimes get short reads leading to failures due to the use of IO#readpartial instead of IO#gets. Modified files: trunk/test/io/console/test_io_console.rb Index: test/io/console/test_io_console.rb =================================================================== --- test/io/console/test_io_console.rb (revision 64247) +++ test/io/console/test_io_console.rb (revision 64248) @@ -136,22 +136,22 @@ defined?(PTY) and defined?(IO.console) a https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L136 sleep 0.1 s.print "b\n" sleep 0.1 - assert_equal("a\r\nb\r\n", m.readpartial(10)) - assert_equal("a\n", s.readpartial(10)) + assert_equal("a\r\nb\r\n", m.gets + m.gets) + assert_equal("a\n", s.gets) s.noecho { assert_not_send([s, :echo?]) m.print "a\n" s.print "b\n" - assert_equal("b\r\n", m.readpartial(10)) - assert_equal("a\n", s.readpartial(10)) + assert_equal("b\r\n", m.gets) + assert_equal("a\n", s.gets) } assert_send([s, :echo?]) m.print "a\n" sleep 0.1 s.print "b\n" sleep 0.1 - assert_equal("a\r\nb\r\n", m.readpartial(10)) - assert_equal("a\n", s.readpartial(10)) + assert_equal("a\r\nb\r\n", m.gets + m.gets) + assert_equal("a\n", s.gets) } end @@ -174,22 +174,22 @@ defined?(PTY) and defined?(IO.console) a https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L174 sleep 0.1 s.print "b\n" sleep 0.1 - assert_equal("a\r\nb\r\n", m.readpartial(10)) - assert_equal("a\n", s.readpartial(10)) + assert_equal("a\r\nb\r\n", m.gets + m.gets) + assert_equal("a\n", s.gets) s.echo = false assert_not_send([s, :echo?]) m.print "a\n" s.print "b\n" - assert_equal("b\r\n", m.readpartial(10)) - assert_equal("a\n", s.readpartial(10)) + assert_equal("b\r\n", m.gets) + assert_equal("a\n", s.gets) s.echo = true assert_send([s, :echo?]) m.print "a\n" sleep 0.1 s.print "b\n" sleep 0.1 - assert_equal("a\r\nb\r\n", m.readpartial(10)) - assert_equal("a\n", s.readpartial(10)) + assert_equal("a\r\nb\r\n", m.gets + m.gets) + assert_equal("a\n", s.gets) } end @@ -211,7 +211,7 @@ defined?(PTY) and defined?(IO.console) a https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L211 s.iflush m.print "b\n" m.flush - assert_equal("b\n", s.readpartial(10)) + assert_equal("b\n", s.gets) } end @@ -232,7 +232,7 @@ defined?(PTY) and defined?(IO.console) a https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L232 s.ioflush m.print "b\n" m.flush - assert_equal("b\n", s.readpartial(10)) + assert_equal("b\n", s.gets) } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/