test/readline/test_readline.rb: fix readline test
for mingw. test/lib/minitest/unit.rb: Add 'guards' for mingw. Removed still-unused method `mswin?` from original patch. [Fix GH-1941] From: MSP-Greg <MSP-Greg@users.noreply.github.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7bde63fad6
commit
6264225c7e
@ -1171,6 +1171,14 @@ module MiniTest
|
|||||||
def windows? platform = RUBY_PLATFORM
|
def windows? platform = RUBY_PLATFORM
|
||||||
/mswin|mingw/ =~ platform
|
/mswin|mingw/ =~ platform
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Is this running on mingw?
|
||||||
|
|
||||||
|
def mingw? platform = RUBY_PLATFORM
|
||||||
|
/mingw/ =~ platform
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -13,17 +13,11 @@ class TestReadline < Test::Unit::TestCase
|
|||||||
SAVED_ENV = %w[COLUMNS LINES]
|
SAVED_ENV = %w[COLUMNS LINES]
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
if ENV.key?('APPVEYOR') && /mingw/ =~ RUBY_PLATFORM
|
|
||||||
skip 'failing on AppVeyor MinGW build for now'
|
|
||||||
end
|
|
||||||
@saved_env = ENV.values_at(*SAVED_ENV)
|
@saved_env = ENV.values_at(*SAVED_ENV)
|
||||||
@inputrc, ENV[INPUTRC] = ENV[INPUTRC], IO::NULL
|
@inputrc, ENV[INPUTRC] = ENV[INPUTRC], IO::NULL
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
if ENV.key?('APPVEYOR') && /mingw/ =~ RUBY_PLATFORM
|
|
||||||
return
|
|
||||||
end
|
|
||||||
ENV[INPUTRC] = @inputrc
|
ENV[INPUTRC] = @inputrc
|
||||||
Readline.instance_variable_set("@completion_proc", nil)
|
Readline.instance_variable_set("@completion_proc", nil)
|
||||||
begin
|
begin
|
||||||
@ -418,6 +412,7 @@ class TestReadline < Test::Unit::TestCase
|
|||||||
end if !/EditLine|\A4\.3\z/n.match(Readline::VERSION)
|
end if !/EditLine|\A4\.3\z/n.match(Readline::VERSION)
|
||||||
|
|
||||||
def test_input_metachar
|
def test_input_metachar
|
||||||
|
skip("Won't pass on mingw w/readline 7.0.005 [ruby-core:45682]") if mingw?
|
||||||
bug6601 = '[ruby-core:45682]'
|
bug6601 = '[ruby-core:45682]'
|
||||||
Readline::HISTORY << "hello"
|
Readline::HISTORY << "hello"
|
||||||
wo = nil
|
wo = nil
|
||||||
@ -427,7 +422,7 @@ class TestReadline < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
assert_equal("hello", line, bug6601)
|
assert_equal("hello", line, bug6601)
|
||||||
ensure
|
ensure
|
||||||
wo.close
|
wo&.close
|
||||||
Readline.delete_text
|
Readline.delete_text
|
||||||
Readline::HISTORY.clear
|
Readline::HISTORY.clear
|
||||||
end if !/EditLine/n.match(Readline::VERSION)
|
end if !/EditLine/n.match(Readline::VERSION)
|
||||||
@ -589,6 +584,11 @@ class TestReadline < Test::Unit::TestCase
|
|||||||
Tempfile.create("test_readline_stdin") {|stdin|
|
Tempfile.create("test_readline_stdin") {|stdin|
|
||||||
Tempfile.create("test_readline_stdout") {|stdout|
|
Tempfile.create("test_readline_stdout") {|stdout|
|
||||||
yield stdin, stdout
|
yield stdin, stdout
|
||||||
|
if windows?
|
||||||
|
# needed since readline holds refs to tempfiles, can't delete on Windows
|
||||||
|
Readline.input = STDIN
|
||||||
|
Readline.output = STDOUT
|
||||||
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user