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

ruby-changes:73917

From: st0012 <ko1@a...>
Date: Sat, 8 Oct 2022 03:17:58 +0900 (JST)
Subject: [ruby-changes:73917] afc1f4fba4 (master): [ruby/irb] Add constant completion test

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

From afc1f4fba4c2e97b3d6afc0c863cf1246320aae3 Mon Sep 17 00:00:00 2001
From: st0012 <stan001212@g...>
Date: Thu, 6 Oct 2022 12:27:16 +0100
Subject: [ruby/irb] Add constant completion test

https://github.com/ruby/irb/commit/39f8fcb058
---
 test/irb/test_completion.rb | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb
index 6b75cf9eea..92228e2f48 100644
--- a/test/irb/test_completion.rb
+++ b/test/irb/test_completion.rb
@@ -194,6 +194,22 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_completion.rb#L194
       end
     end
 
+    class TestConstantCompletion < TestCompletion
+      class Foo
+        B1 = 1
+        B2 = 2
+      end
+
+      def test_complete_constants
+        assert_equal(["Foo"], IRB::InputCompletor.retrieve_completion_data("Fo", bind: binding))
+        assert_equal(["Foo::B1", "Foo::B2"], IRB::InputCompletor.retrieve_completion_data("Foo::B", bind: binding))
+        assert_equal(["Foo::B1.positive?"], IRB::InputCompletor.retrieve_completion_data("Foo::B1.pos", bind: binding))
+
+        assert_equal(["::Forwardable"], IRB::InputCompletor.retrieve_completion_data("::Fo", bind: binding))
+        assert_equal("Forwardable", IRB::InputCompletor.retrieve_completion_data("::Forwardable", bind: binding, doc_namespace: true))
+      end
+    end
+
     def test_complete_symbol
       %w"UTF-16LE UTF-7".each do |enc|
         "K".force_encoding(enc).to_sym
-- 
cgit v1.2.1


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

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