mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Re-commit r65722
which was accidentally reverted by r65904
158562dabb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
49efa01579
commit
70a385a4f6
1 changed files with 5 additions and 4 deletions
|
@ -4,6 +4,7 @@ require 'rubygems/user_interaction'
|
||||||
require 'timeout'
|
require 'timeout'
|
||||||
|
|
||||||
class TestGemStreamUI < Gem::TestCase
|
class TestGemStreamUI < Gem::TestCase
|
||||||
|
SHORT_TIMEOUT = (defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?) ? 1.0 : 0.1 # increase timeout with MJIT for --jit-wait testing
|
||||||
|
|
||||||
module IsTty
|
module IsTty
|
||||||
attr_accessor :tty
|
attr_accessor :tty
|
||||||
|
@ -47,7 +48,7 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
def test_ask_no_tty
|
def test_ask_no_tty
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
Timeout.timeout(0.1) do
|
Timeout.timeout(SHORT_TIMEOUT) do
|
||||||
answer = @sui.ask("what is your favorite color?")
|
answer = @sui.ask("what is your favorite color?")
|
||||||
assert_nil answer
|
assert_nil answer
|
||||||
end
|
end
|
||||||
|
@ -65,7 +66,7 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
def test_ask_for_password_no_tty
|
def test_ask_for_password_no_tty
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
Timeout.timeout(0.1) do
|
Timeout.timeout(SHORT_TIMEOUT) do
|
||||||
answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
|
answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
|
||||||
assert_nil answer
|
assert_nil answer
|
||||||
end
|
end
|
||||||
|
@ -74,7 +75,7 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
def test_ask_yes_no_no_tty_with_default
|
def test_ask_yes_no_no_tty_with_default
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
Timeout.timeout(0.1) do
|
Timeout.timeout(SHORT_TIMEOUT) do
|
||||||
answer = @sui.ask_yes_no("do coconuts migrate?", false)
|
answer = @sui.ask_yes_no("do coconuts migrate?", false)
|
||||||
assert_equal false, answer
|
assert_equal false, answer
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
def test_ask_yes_no_no_tty_without_default
|
def test_ask_yes_no_no_tty_without_default
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
Timeout.timeout(0.1) do
|
Timeout.timeout(SHORT_TIMEOUT) do
|
||||||
assert_raises(Gem::OperationNotSupportedError) do
|
assert_raises(Gem::OperationNotSupportedError) do
|
||||||
@sui.ask_yes_no("do coconuts migrate?")
|
@sui.ask_yes_no("do coconuts migrate?")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue