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

ruby-changes:62983

From: aycabta <ko1@a...>
Date: Wed, 16 Sep 2020 21:24:14 +0900 (JST)
Subject: [ruby-changes:62983] 21c1b676c4 (ruby_2_7): Merge latest readline-ext

https://git.ruby-lang.org/ruby.git/commit/?id=21c1b676c4

From 21c1b676c4e9075549978918304206218478c459 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Wed, 16 Sep 2020 11:36:44 +0900
Subject: Merge latest readline-ext


diff --git a/ext/readline/readline-ext.gemspec b/ext/readline/readline-ext.gemspec
index b85e07d..66db14d 100644
--- a/ext/readline/readline-ext.gemspec
+++ b/ext/readline/readline-ext.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec| https://github.com/ruby/ruby/blob/trunk/ext/readline/readline-ext.gemspec#L7
   spec.summary       = %q{Provides an interface for GNU Readline and Edit Line (libedit).}
   spec.description   = %q{Provides an interface for GNU Readline and Edit Line (libedit).}
   spec.homepage      = "https://github.com/ruby/readline-ext"
-  spec.license       = "BSD-2-Clause"
+  spec.licenses      = ["Ruby", "BSD-2-Clause"]
   spec.extensions    = %w[ext/readline/extconf.rb]
 
   spec.metadata["homepage_uri"] = spec.homepage
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index 7ac2212..12cac20 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -150,10 +150,13 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L150
 
   def test_completion_case_fold
     expected = [true, false, "string", {"a" => "b"}]
+    completion_case_fold = Readline.completion_case_fold
     expected.each do |e|
       Readline.completion_case_fold = e
       assert_equal(e, Readline.completion_case_fold)
     end
+  ensure
+    Readline.completion_case_fold = completion_case_fold
   end
 
   def test_completion_proc_empty_result
@@ -593,7 +596,14 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L596
         end
         w.write("a\t\n")
         w.flush
-        line = Readline.readline('> ', false)
+        begin
+          stderr = $stderr.dup
+          $stderr.reopen(null)
+          line = Readline.readline('> ', false)
+        ensure
+          $stderr.reopen(stderr)
+          stderr.close
+        end
       end
     end
 
@@ -632,6 +642,8 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L642
   def test_completion_quote_character_completing_unquoted_argument
     return unless Readline.respond_to?(:completion_quote_character)
 
+    saved_completer_quote_characters = Readline.completer_quote_characters
+
     quote_character = "original value"
     Readline.completion_proc = -> (_) do
       quote_character = Readline.completion_quote_character
@@ -648,11 +660,15 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L660
     end
 
     assert_nil(quote_character)
+  ensure
+    Readline.completer_quote_characters = saved_completer_quote_characters if saved_completer_quote_characters
   end
 
   def test_completion_quote_character_completing_quoted_argument
     return unless Readline.respond_to?(:completion_quote_character)
 
+    saved_completer_quote_characters = Readline.completer_quote_characters
+
     quote_character = "original value"
     Readline.completion_proc = -> (_) do
       quote_character = Readline.completion_quote_character
@@ -669,6 +685,8 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L685
     end
 
     assert_equal("'", quote_character)
+  ensure
+    Readline.completer_quote_characters = saved_completer_quote_characters if saved_completer_quote_characters
   end
 
   def test_completion_quote_character_after_completion
@@ -679,6 +697,8 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L697
     end
     omit 'Needs GNU Readline 6 or later' if /mswin|mingw/ =~ RUBY_PLATFORM and defined?(TestReadline) and kind_of?(TestReadline) and Readline::VERSION < '6.0'
 
+    saved_completer_quote_characters = Readline.completer_quote_characters
+
     Readline.completion_proc = -> (_) { [] }
     Readline.completer_quote_characters = "'\""
 
@@ -691,6 +711,8 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L711
     end
 
     assert_nil(Readline.completion_quote_character)
+  ensure
+    Readline.completer_quote_characters = saved_completer_quote_characters if saved_completer_quote_characters
   end
 
   private
-- 
cgit v0.10.2


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

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