mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
chore: fix ShellCheck errors in tests (#1433)
This commit is contained in:
parent
06cd31a59c
commit
407a6696c0
@ -3,16 +3,17 @@
|
|||||||
load test_helpers
|
load test_helpers
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
export XDG_CONFIG_HOME= XDG_DATA_HOME= XDG_DATA_DIRS=
|
export XDG_CONFIG_HOME=
|
||||||
|
export XDG_DATA_HOME=
|
||||||
|
export XDG_DATA_DIRS=
|
||||||
|
|
||||||
local version=
|
local ver_major=
|
||||||
version=$(elvish -version)
|
local ver_minor=
|
||||||
|
local ver_patch=
|
||||||
|
IFS='.' read -r ver_major ver_minor ver_patch <<<"$(elvish -version)"
|
||||||
|
|
||||||
local ver_major= ver_minor= ver_patch=
|
if ((ver_major == 0 && ver_minor < 18)); then
|
||||||
IFS='.' read -r ver_major ver_minor ver_patch <<<"$version"
|
skip "Elvish version is not at least 0.18. Found ${ver_major}.${ver_minor}.${ver_patch}"
|
||||||
|
|
||||||
if ((ver_major == 0 && ver_minor <= 17)); then
|
|
||||||
skip "Elvish version is not at least 0.17"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@ foobar 1.0.0 $PROJECT_DIR/.tool-versions"
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "current should handle comments" {
|
@test "current should handle comments" {
|
||||||
cd $PROJECT_DIR
|
cd "$PROJECT_DIR"
|
||||||
echo "dummy 1.2.0 # this is a comment" >>$PROJECT_DIR/.tool-versions
|
echo "dummy 1.2.0 # this is a comment" >>"$PROJECT_DIR/.tool-versions"
|
||||||
expected="dummy 1.2.0 $PROJECT_DIR/.tool-versions"
|
expected="dummy 1.2.0 $PROJECT_DIR/.tool-versions"
|
||||||
|
|
||||||
run asdf current "dummy"
|
run asdf current "dummy"
|
||||||
|
@ -95,7 +95,7 @@ teardown() {
|
|||||||
run grep "asdf-plugin: dummy 1.0.0" $ASDF_DIR/shims/dummy
|
run grep "asdf-plugin: dummy 1.0.0" $ASDF_DIR/shims/dummy
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
run grep "# asdf-plugin: dummy 1.0.0"$'\n'"# asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy
|
run grep "# asdf-plugin: dummy 1.0.0"$'\n'"# asdf-plugin: dummy 1.1.0" "$ASDF_DIR/shims/dummy"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
lines_count=$(grep "asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy | wc -l)
|
lines_count=$(grep "asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy | wc -l)
|
||||||
|
@ -57,7 +57,7 @@ teardown() {
|
|||||||
run asdf install dummy 1.0
|
run asdf install dummy 1.0
|
||||||
|
|
||||||
# make an unrelated shim
|
# make an unrelated shim
|
||||||
echo "# asdf-plugin: gummy" >$ASDF_DIR/shims/gummy
|
echo "# asdf-plugin: gummy" >"$ASDF_DIR/shims/gummy"
|
||||||
|
|
||||||
run asdf plugin-remove dummy
|
run asdf plugin-remove dummy
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
@ -394,8 +394,8 @@ teardown() {
|
|||||||
|
|
||||||
exec_path="$ASDF_DIR/plugins/dummy/bin/exec-path"
|
exec_path="$ASDF_DIR/plugins/dummy/bin/exec-path"
|
||||||
|
|
||||||
echo 'echo $3 # always same path' >$exec_path
|
echo 'echo $3 # always same path' >"$exec_path"
|
||||||
chmod +x $exec_path
|
chmod +x "$exec_path"
|
||||||
|
|
||||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ teardown() {
|
|||||||
|
|
||||||
run asdf local "dummy" "1.1.0"
|
run asdf local "dummy" "1.1.0"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$(ls $PROJECT_DIR/.tool-versions* | wc -l)" -eq 1 ]
|
[ "$(ls "$PROJECT_DIR/.tool-versions"* | wc -l)" -eq 1 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "local should overwrite the existing version if it's set" {
|
@test "local should overwrite the existing version if it's set" {
|
||||||
|
Loading…
Reference in New Issue
Block a user