[ruby/irb] Sort constant completion's candidates
https://github.com/ruby/irb/commit/ee9b33c817
This commit is contained in:
parent
7cafe09aec
commit
5b3079a8a5
@ -255,7 +255,7 @@ module IRB
|
|||||||
candidates = []
|
candidates = []
|
||||||
end
|
end
|
||||||
|
|
||||||
select_message(receiver, message, candidates, "::")
|
select_message(receiver, message, candidates.sort, "::")
|
||||||
end
|
end
|
||||||
|
|
||||||
when /^(:[^:.]+)(\.|::)([^.]*)$/
|
when /^(:[^:.]+)(\.|::)([^.]*)$/
|
||||||
|
@ -196,13 +196,14 @@ module TestIRB
|
|||||||
|
|
||||||
class TestConstantCompletion < TestCompletion
|
class TestConstantCompletion < TestCompletion
|
||||||
class Foo
|
class Foo
|
||||||
|
B3 = 1
|
||||||
B1 = 1
|
B1 = 1
|
||||||
B2 = 2
|
B2 = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_complete_constants
|
def test_complete_constants
|
||||||
assert_equal(["Foo"], IRB::InputCompletor.retrieve_completion_data("Fo", bind: binding))
|
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", "Foo::B2", "Foo::B3"], 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(["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("::Fo", bind: binding))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user