diff --git a/README.md b/README.md index 95a6ead..1100e00 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Also adds binaries from installed SDKs to the PATH. Version 1.4.0 tested with - fish 2.7.1 and 3.1.2, and - - SDKMAN! 5.8.2, on + - SDKMAN! 5.9.1, on - Ubuntu 18.04 LTS and macOS 10.13 ## Install diff --git a/test/features/completions.feature b/test/features/completions.feature index d2a2710..feaaa6f 100644 --- a/test/features/completions.feature +++ b/test/features/completions.feature @@ -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 "" But completion should not propose 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 " into the prompt + Then completion should propose "" + But completion should not propose + 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 " into the prompt + Then completion should propose "" + But completion should not propose + Examples: + | cmd | completions | exclusions | + | | init | /^(?!init).*$/ | + | i | init | /^(?!init).*$/ | + | a | | /.*/ | + | 'init ' | | /.*/ | Scenario Outline: Completion for commands without parameters When the user enters "" into the prompt diff --git a/test/features/step_definitions/setup.rb b/test/features/step_definitions/setup.rb index 69fdd04..90c6ae9 100644 --- a/test/features/step_definitions/setup.rb +++ b/test/features/step_definitions/setup.rb @@ -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: diff --git a/test/features/wrapper.feature b/test/features/wrapper.feature index 529c61f..3e3304f 100644 --- a/test/features/wrapper.feature +++ b/test/features/wrapper.feature @@ -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 "" 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 |