-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code.sh: Make more robust against installation problems
If code.sh was a symlink but not a direct symlink to the installation directory, that caused hard to resolve problems. Check the value we get from readlink to make sure that podman-host.sh is where we expect. Fixes #6
- Loading branch information
Showing
2 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# shellcheck shell=bash | ||
|
||
mock_no_symlink() { | ||
: | ||
} | ||
|
||
test_no_symlink() { | ||
mkdir ~/project | ||
cd ~/project || exit 1 | ||
if /source/code.sh --toolbox-verbose . > out 2>&1 ; then | ||
echo "Running script directly should fail" | ||
return 1 | ||
fi || : | ||
assert_contents out <<'EOF' | ||
code.sh: Only symlinked installation currently supported | ||
EOF | ||
} | ||
|
||
mock_two_symlinks() { | ||
: | ||
} | ||
|
||
test_two_symlinks() { | ||
mkdir ~/project | ||
cd ~/project || exit 1 | ||
ln -s /home/testuser/.local/bin/code . | ||
if ./code --toolbox-verbose . > out 2>&1 ; then | ||
echo "Running script through double symlink should fail" | ||
return 1 | ||
fi || : | ||
assert_contents out <<'EOF' | ||
code: ./code should be a symlink to code.sh in the toolbox-vscode checkout | ||
EOF | ||
} |