提交 d6ba91f7 编写于 作者: M Mislav Marohnić

Compensate for variable sorting in bash shell completion

Fixes https://travis-ci.org/github/hub/jobs/13920941
上级 a766b98b
...@@ -18,12 +18,12 @@ Feature: bash tab-completion ...@@ -18,12 +18,12 @@ Feature: bash tab-completion
Scenario: Offers pull-request flags Scenario: Offers pull-request flags
When I type "git pull-request -" and press <Tab> When I type "git pull-request -" and press <Tab>
When I press <Tab> again When I press <Tab> again
Then the completion menu should offer "-F -b -f -h -i -m" Then the completion menu should offer "-F -b -f -h -i -m" unsorted
Scenario: Doesn't offer already used pull-request flags Scenario: Doesn't offer already used pull-request flags
When I type "git pull-request -F myfile -h mybranch -" and press <Tab> When I type "git pull-request -F myfile -h mybranch -" and press <Tab>
When I press <Tab> again When I press <Tab> again
Then the completion menu should offer "-b -f -i -m" Then the completion menu should offer "-b -f -i -m" unsorted
Scenario: Browse to issues Scenario: Browse to issues
When I type "git browse -- i" and press <Tab> When I type "git browse -- i" and press <Tab>
......
...@@ -131,7 +131,7 @@ World Module.new { ...@@ -131,7 +131,7 @@ World Module.new {
def tmux_wait_for_completion def tmux_wait_for_completion
# bash can be pretty slow # bash can be pretty slow
sleep 0.6 sleep 1
end end
def tmux_completion_menu def tmux_completion_menu
...@@ -188,8 +188,12 @@ When(/^I press <Tab> again$/) do ...@@ -188,8 +188,12 @@ When(/^I press <Tab> again$/) do
tmux_send_keys('Tab') tmux_send_keys('Tab')
end end
Then(/^the completion menu should offer "([^"]+?)"$/) do |items| Then(/^the completion menu should offer "([^"]+?)"( unsorted)?$/) do |items, unsorted|
menu = tmux_completion_menu_basic menu = tmux_completion_menu_basic
if unsorted
menu.sort!
items = items.split(' ').sort.join(' ')
end
menu.join(' ').should eq(items) menu.join(' ').should eq(items)
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册