[前][次][番号順一覧][スレッド一覧]

ruby-changes:52317

From: k0kubun <ko1@a...>
Date: Fri, 24 Aug 2018 08:50:55 +0900 (JST)
Subject: [ruby-changes:52317] k0kubun:r64525 (trunk): test/readline/test_readline.rb: fix readline test

k0kubun	2018-08-24 08:50:48 +0900 (Fri, 24 Aug 2018)

  New Revision: 64525

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64525

  Log:
    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@u...>

  Modified files:
    trunk/test/lib/minitest/unit.rb
    trunk/test/readline/test_readline.rb
Index: test/lib/minitest/unit.rb
===================================================================
--- test/lib/minitest/unit.rb	(revision 64524)
+++ test/lib/minitest/unit.rb	(revision 64525)
@@ -1171,6 +1171,14 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/test/lib/minitest/unit.rb#L1171
       def windows? platform = RUBY_PLATFORM
         /mswin|mingw/ =~ platform
       end
+
+      ##
+      # Is this running on mingw?
+
+      def mingw? platform = RUBY_PLATFORM
+        /mingw/ =~ platform
+      end
+
     end
 
     ##
Index: test/readline/test_readline.rb
===================================================================
--- test/readline/test_readline.rb	(revision 64524)
+++ test/readline/test_readline.rb	(revision 64525)
@@ -13,17 +13,11 @@ class TestReadline < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L13
   SAVED_ENV = %w[COLUMNS LINES]
 
   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)
     @inputrc, ENV[INPUTRC] = ENV[INPUTRC], IO::NULL
   end
 
   def teardown
-    if ENV.key?('APPVEYOR') && /mingw/ =~ RUBY_PLATFORM
-      return
-    end
     ENV[INPUTRC] = @inputrc
     Readline.instance_variable_set("@completion_proc", nil)
     begin
@@ -418,6 +412,7 @@ class TestReadline < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L412
   end if !/EditLine|\A4\.3\z/n.match(Readline::VERSION)
 
   def test_input_metachar
+    skip("Won't pass on mingw w/readline 7.0.005 [ruby-core:45682]") if mingw?
     bug6601 = '[ruby-core:45682]'
     Readline::HISTORY << "hello"
     wo = nil
@@ -427,7 +422,7 @@ class TestReadline < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L422
     end
     assert_equal("hello", line, bug6601)
   ensure
-    wo.close
+    wo&.close
     Readline.delete_text
     Readline::HISTORY.clear
   end if !/EditLine/n.match(Readline::VERSION)
@@ -589,6 +584,11 @@ class TestReadline < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L584
     Tempfile.create("test_readline_stdin") {|stdin|
       Tempfile.create("test_readline_stdout") {|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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]