mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Merge branch 'local-whitespace-fix'
This commit is contained in:
commit
c007ac728b
@ -18,10 +18,10 @@ version_command() {
|
|||||||
check_if_plugin_exists $plugin
|
check_if_plugin_exists $plugin
|
||||||
check_if_version_exists $plugin $version
|
check_if_version_exists $plugin $version
|
||||||
|
|
||||||
if [ -f $file ] && grep $plugin $file > /dev/null; then
|
if [ -f "$file" ] && grep $plugin "$file" > /dev/null; then
|
||||||
sed -i -e "s/$plugin .*/$plugin $version/" $file
|
sed -i -e "s/$plugin .*/$plugin $version/" "$file"
|
||||||
else
|
else
|
||||||
echo "$plugin $version" >> $file
|
echo "$plugin $version" >> "$file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,18 @@ teardown() {
|
|||||||
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0" ]
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "local should create a local .tool-versions file if it doesn't exist when the directory name contains whitespace" {
|
||||||
|
WHITESPACE_DIR="$PROJECT_DIR/whitespace\ dir"
|
||||||
|
mkdir -p "$WHITESPACE_DIR"
|
||||||
|
cd "$WHITESPACE_DIR"
|
||||||
|
|
||||||
|
run local_command "dummy" "1.1.0"
|
||||||
|
|
||||||
|
tool_version_contents=$(cat "$WHITESPACE_DIR/.tool-versions")
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "$tool_version_contents" = "dummy 1.1.0" ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "local should overwrite the existing version if it's set" {
|
@test "local should overwrite the existing version if it's set" {
|
||||||
echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions
|
echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions
|
||||||
run local_command "dummy" "1.1.0"
|
run local_command "dummy" "1.1.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user