Skip to content

Commit 0e04785

Browse files
committed
Test the getch timeout on an isolated pty with no input
Testing on the default tty should be performed only in the CI environment.
1 parent 163bd51 commit 0e04785

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎test/io/console/test_io_console.rb‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ def test_intr
610610
end
611611
end
612612

613+
def test_getch_timeout
614+
assert_equal(["nil"], run_pty("p IO.console.getch(intr: true, time: 0.1, min: 0)"))
615+
end
616+
613617
unless IO.console
614618
def test_close
615619
assert_equal(["true"], run_pty("IO.console.close; p IO.console.fileno >= 0"))
@@ -719,7 +723,7 @@ def test_sync
719723

720724
def test_getch_timeout
721725
assert_nil(IO.console.getch(intr: true, time: 0.1, min: 0))
722-
end
726+
end if ENV["CI"]
723727

724728
def test_ttyname
725729
return unless IO.method_defined?(:ttyname)

0 commit comments

Comments
 (0)