mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -07:00
parent
9b563135ed
commit
193189ed91
4 changed files with 50 additions and 11 deletions
|
@ -20,8 +20,11 @@ Feature: Shell Completion
|
|||
| b | b, broadcast | /^[^b]+$/ |
|
||||
| c | c, current | /^[^c]+$/ |
|
||||
| d | d, default | /^[^d]+$/ |
|
||||
| e | e, env | /^[^e]+$/ |
|
||||
| f | flush | /^[^f]+$/ |
|
||||
| h | h, help | /^[^h]+$/ |
|
||||
| h | h, help, home | /^[^h]+$/ |
|
||||
| he | help | |
|
||||
| ho | home | |
|
||||
| i | i, install | /^[^i]+$/ |
|
||||
| in | install | |
|
||||
| l | list, ls | /^[^l]+$/ |
|
||||
|
@ -36,7 +39,6 @@ Feature: Shell Completion
|
|||
# Currently uncovered (except by fuzzy matches);
|
||||
# include negatives to prevent accidents:
|
||||
| a | | /^a/ |
|
||||
| e | | /^e/ |
|
||||
| g | | /^g/ |
|
||||
| j | | /^j/ |
|
||||
| k | | /^k/ |
|
||||
|
@ -175,14 +177,38 @@ Feature: Shell Completion
|
|||
Then completion should propose "<completions>"
|
||||
But completion should not propose <exclusions>
|
||||
Examples:
|
||||
| cmd | completions | exclusions |
|
||||
| | archives, broadcast, temp | /^(?!archives\|broadcast\|temp).*$/ |
|
||||
| b | broadcast | /^(?!broadcast).*$/ |
|
||||
| a | archives | /^(?!archives\|broadcast).*$/ |
|
||||
| t | temp | /^(?!temp\|broadcast).*$/ |
|
||||
| x | | /.*/ |
|
||||
| 'temp ' | | /.*/ |
|
||||
| cmd | completions | exclusions |
|
||||
| | archives, broadcast, tmp, version | /^(?!archives\|broadcast\|tmp\|version).*$/ |
|
||||
| b | broadcast | /^(?!broadcast).*$/ |
|
||||
| a | archives | /^(?!archives\|broadcast).*$/ |
|
||||
| t | tmp | /^(?!tmp\|broadcast).*$/ |
|
||||
| v | version | /^(?!version\|archives).*$/ |
|
||||
| x | | /.*/ |
|
||||
| 'tmp ' | | /.*/ |
|
||||
|
||||
Scenario Outline: Completion for 'home'
|
||||
When the user enters "home <cmd>" into the prompt
|
||||
Then completion should propose "<completions>"
|
||||
But completion should not propose <exclusions>
|
||||
Examples:
|
||||
| cmd | completions | exclusions |
|
||||
| | ant, crash | gradle |
|
||||
| an | ant | crash, gradle |
|
||||
| j | | /.*/ |
|
||||
| 1. | | /.*/ |
|
||||
| 'ant ' | 1.10.1, 1.9.9 | /^\w+$/ |
|
||||
| 'ant 1.10.1 ' | | /.*/ |
|
||||
|
||||
Scenario Outline: Completion for 'env'
|
||||
When the user enters "env <cmd>" into the prompt
|
||||
Then completion should propose "<completions>"
|
||||
But completion should not propose <exclusions>
|
||||
Examples:
|
||||
| cmd | completions | exclusions |
|
||||
| | init | /^(?!init).*$/ |
|
||||
| i | init | /^(?!init).*$/ |
|
||||
| a | | /.*/ |
|
||||
| 'init ' | | /.*/ |
|
||||
|
||||
Scenario Outline: Completion for commands without parameters
|
||||
When the user enters "<cmd>" into the prompt
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'fileutils'
|
||||
|
||||
$index_updated = false # TODO: Hack since Cucumber doesn't have Feature-level hooks
|
||||
Given(/^SDKMAN! candidate list is up to date$/) do
|
||||
unless $index_updated
|
||||
|
@ -39,6 +41,11 @@ When(/^candidate (\w+) is uninstalled$/) do |candidate|
|
|||
puts `ls ~/.sdkman/candidates/#{candidate}`
|
||||
end
|
||||
|
||||
Given(/^file ([a-zA-Z0-9-_.\/]+) exists with content/) do |filename,content|
|
||||
FileUtils.mkdir_p(File.dirname(filename))
|
||||
File.write(filename, content)
|
||||
end
|
||||
|
||||
# Uninstall all SDKMAN! candidates
|
||||
# TODO: Run after every scenario, this makes tests very slow.
|
||||
# Currently, Cucumber doesn't have Feature-level hooks, so we have to work around:
|
||||
|
|
|
@ -4,12 +4,16 @@ Feature: Wrapping of Bash
|
|||
the effect sdk has on the Bash environment carries
|
||||
over the current Fish session.
|
||||
|
||||
We verifiy equality of (standard) output, exit code, and environment variables.
|
||||
We verify equality of (standard) output, exit code, and environment variables.
|
||||
|
||||
Background:
|
||||
Given SDKMAN! candidate list is up to date
|
||||
And candidate ant is installed at version 1.9.9
|
||||
And candidate ant is installed at version 1.10.1
|
||||
And file /tmp/env-test/.sdkmanrc exists with content
|
||||
"""
|
||||
ant=1.9.9
|
||||
"""
|
||||
|
||||
Scenario Outline:
|
||||
When we run "<command>" in Bash and Fish
|
||||
|
@ -28,3 +32,5 @@ Feature: Wrapping of Bash
|
|||
| sdk use ant 1.9.9 |
|
||||
| sdk offline enable > /dev/null; sdk install ant foo |
|
||||
| sdk use ant 1.9.9 > /dev/null; sdk broadcast |
|
||||
| sdk home ant 1.9.9 |
|
||||
| cd /tmp/env-test; sdk env |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue