mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
parent
2bf076f3d3
commit
34593c1766
@ -454,7 +454,10 @@ resolve_symlink() {
|
||||
printf "%s\\n" "$resolved_path"
|
||||
;;
|
||||
*)
|
||||
printf "%s\\n" "$PWD/$resolved_path"
|
||||
(
|
||||
cd "$(dirname "$symlink")" || exit 1
|
||||
printf "%s\\n" "$PWD/$resolved_path"
|
||||
)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -355,18 +355,26 @@ teardown() {
|
||||
|
||||
run resolve_symlink bar
|
||||
[ "$status" -eq 0 ]
|
||||
echo $status
|
||||
[ "$output" = $(pwd)/foo ]
|
||||
rm -f foo bar
|
||||
}
|
||||
|
||||
@test "resolve_symlink converts relative symlink directory path to the real file path" {
|
||||
mkdir baz
|
||||
ln -s ../foo baz/bar
|
||||
|
||||
run resolve_symlink baz/bar
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = $(pwd)/baz/../foo ]
|
||||
rm -f foo bar
|
||||
}
|
||||
|
||||
@test "resolve_symlink converts relative symlink path to the real file path" {
|
||||
touch foo
|
||||
ln -s foo bar
|
||||
|
||||
run resolve_symlink bar
|
||||
[ "$status" -eq 0 ]
|
||||
echo $status
|
||||
[ "$output" = $(pwd)/foo ]
|
||||
rm -f foo bar
|
||||
}
|
||||
|
@ -208,26 +208,26 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "global should preserve symlinks when setting versions" {
|
||||
mkdir other-dir
|
||||
touch other-dir/.tool-versions
|
||||
mkdir $HOME/other-dir
|
||||
touch $HOME/other-dir/.tool-versions
|
||||
ln -s other-dir/.tool-versions $HOME/.tool-versions
|
||||
|
||||
run asdf global "dummy" "1.1.0"
|
||||
[ "$status" -eq 0 ]
|
||||
[ -L $HOME/.tool-versions ]
|
||||
[ "$(cat other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
||||
[ "$(cat $HOME/other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
||||
}
|
||||
|
||||
@test "global should preserve symlinks when updating versions" {
|
||||
mkdir other-dir
|
||||
touch other-dir/.tool-versions
|
||||
mkdir $HOME/other-dir
|
||||
touch $HOME/other-dir/.tool-versions
|
||||
ln -s other-dir/.tool-versions $HOME/.tool-versions
|
||||
|
||||
run asdf global "dummy" "1.1.0"
|
||||
run asdf global "dummy" "1.1.0"
|
||||
[ "$status" -eq 0 ]
|
||||
[ -L $HOME/.tool-versions ]
|
||||
[ "$(cat other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
||||
[ "$(cat $HOME/other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
||||
}
|
||||
|
||||
@test "shell wrapper function should export ENV var" {
|
||||
|
Loading…
Reference in New Issue
Block a user