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

ruby-changes:67863

From: aycabta <ko1@a...>
Date: Sat, 11 Sep 2021 04:41:35 +0900 (JST)
Subject: [ruby-changes:67863] 3e038ab1c7 (master): [ruby/irb] Ignore invalid 3 colons in completion

https://git.ruby-lang.org/ruby.git/commit/?id=3e038ab1c7

From 3e038ab1c7f0009f753bfada2e18fb6078a92c12 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sat, 11 Sep 2021 04:30:29 +0900
Subject: [ruby/irb] Ignore invalid 3 colons in completion

https://github.com/ruby/irb/commit/5e29e3e39c
---
 lib/irb/completion.rb       | 2 +-
 test/irb/test_completion.rb | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 812ebb0..fe2962e 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -286,7 +286,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L286
           all_gvars.grep(Regexp.new(Regexp.quote(gvar)))
         end
 
-      when /^([^."].*)(\.|::)([^.]*)$/
+      when /^([^.:"].*)(\.|::)([^.]*)$/
         # variable.func or func.func
         receiver = $1
         sep = $2
diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb
index 1ae1b7a..f00eda0 100644
--- a/test/irb/test_completion.rb
+++ b/test/irb/test_completion.rb
@@ -32,6 +32,11 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_completion.rb#L32
       assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
     end
 
+    def test_complete_invalid_three_colons
+      assert_empty(IRB::InputCompletor.retrieve_completion_data(":::A", bind: binding))
+      assert_empty(IRB::InputCompletor.retrieve_completion_data(":::", bind: binding))
+    end
+
     def test_complete_symbol_failure
       assert_nil(IRB::InputCompletor::PerfectMatchedProc.(":aiueo", bind: binding))
     end
-- 
cgit v1.1


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

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