mirror of
https://github.com/ethauvin/sdkman-for-fish.git
synced 2025-04-25 05:17:11 -07:00
Verify (re-)initialization of SDKMAN env vars works.
- Add new test that covers the two cases considered so far. Housekeeping: - Add `.gitignore` - Add `.editorconfig`
This commit is contained in:
parent
ddb3b3042b
commit
0d080212d2
4 changed files with 33 additions and 0 deletions
25
test/reinitialize.fish
Executable file
25
test/reinitialize.fish
Executable file
|
@ -0,0 +1,25 @@
|
|||
# If either of
|
||||
# - $SDKMAN_DIR is unset
|
||||
# - $SDKMAN_DIR points to a directory not owned by the current user
|
||||
# is true, sdkman-for-fish should run sdkman's init script.
|
||||
|
||||
# Assumes sdkman-for-fish is installed
|
||||
set proper_value "$SDKMAN_DIR"
|
||||
|
||||
begin
|
||||
set -e SDKMAN_DIR
|
||||
set in_new_shell (fish -lc 'echo $SDKMAN_DIR')
|
||||
if [ "$in_new_shell" != "$proper_value" ]
|
||||
echo "SDKMAN_DIR initialized to $in_new_shell instead of $proper_value"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
set SDKMAN_DIR "/" # belongs to root, who hopefully doesn't run this
|
||||
set in_new_shell (fish -lc 'echo $SDKMAN_DIR')
|
||||
if [ "$in_new_shell" != "$proper_value" ]
|
||||
echo "SDKMAN_DIR reinitialized to $in_new_shell instead of $proper_value"
|
||||
exit 1
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue