2016-04-24 08:11:33 -07:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
2016-06-28 20:56:33 -07:00
|
|
|
load test_helpers
|
|
|
|
|
2016-04-24 08:11:33 -07:00
|
|
|
setup() {
|
2016-06-28 20:56:33 -07:00
|
|
|
setup_asdf_dir
|
2016-07-23 00:15:05 -07:00
|
|
|
install_dummy_plugin
|
|
|
|
install_dummy_version "1.0.0"
|
|
|
|
install_dummy_version "1.1.0"
|
2020-09-18 22:37:52 -07:00
|
|
|
install_dummy_version "2.0.0"
|
2016-06-28 20:56:33 -07:00
|
|
|
|
2016-07-23 05:46:02 -07:00
|
|
|
PROJECT_DIR=$HOME/project
|
2016-07-23 00:15:05 -07:00
|
|
|
mkdir -p $PROJECT_DIR
|
2016-04-24 08:11:33 -07:00
|
|
|
|
2018-10-18 19:09:23 -07:00
|
|
|
CHILD_DIR=$PROJECT_DIR/child-dir
|
|
|
|
mkdir -p $CHILD_DIR
|
|
|
|
|
2016-07-23 00:15:05 -07:00
|
|
|
cd $PROJECT_DIR
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
teardown() {
|
2016-06-28 20:56:33 -07:00
|
|
|
clean_asdf_dir
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
2016-07-23 05:46:02 -07:00
|
|
|
# Warn users who invoke the old style command without arguments.
|
|
|
|
@test "local should emit an error when called with incorrect arity" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy"
|
2016-04-24 08:11:33 -07:00
|
|
|
[ "$status" -eq 1 ]
|
2016-07-23 05:46:02 -07:00
|
|
|
[ "$output" = "Usage: asdf local <name> <version>" ]
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "local should emit an error when plugin does not exist" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "inexistent" "1.0.0"
|
2016-04-24 08:11:33 -07:00
|
|
|
[ "$status" -eq 1 ]
|
2018-04-30 09:49:40 -07:00
|
|
|
[ "$output" = "No such plugin: inexistent" ]
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "local should emit an error when plugin version does not exist" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "0.0.1"
|
2016-04-24 08:11:33 -07:00
|
|
|
[ "$status" -eq 1 ]
|
2016-07-23 00:15:05 -07:00
|
|
|
[ "$output" = "version 0.0.1 is not installed for dummy" ]
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
|
|
|
|
2016-07-23 05:46:02 -07:00
|
|
|
@test "local should create a local .tool-versions file if it doesn't exist" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0"
|
2016-05-13 19:11:16 -07:00
|
|
|
[ "$status" -eq 0 ]
|
2016-07-23 05:46:02 -07:00
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0" ]
|
2016-05-02 08:27:05 -07:00
|
|
|
}
|
|
|
|
|
2016-08-29 23:46:14 -07:00
|
|
|
@test "local should allow multiple versions" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0" "1.0.0"
|
2016-08-29 23:46:14 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0 1.0.0" ]
|
|
|
|
}
|
|
|
|
|
2016-08-16 07:52:37 -07:00
|
|
|
@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"
|
|
|
|
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0"
|
2016-08-16 07:52:37 -07:00
|
|
|
|
|
|
|
tool_version_contents=$(cat "$WHITESPACE_DIR/.tool-versions")
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$tool_version_contents" = "dummy 1.1.0" ]
|
|
|
|
}
|
|
|
|
|
2017-10-26 12:58:45 -07:00
|
|
|
@test "local should not create a duplicate .tool-versions file if such file exists" {
|
|
|
|
echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions
|
|
|
|
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0"
|
2017-10-26 12:58:45 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(ls $PROJECT_DIR/.tool-versions* | wc -l)" -eq 1 ]
|
|
|
|
}
|
|
|
|
|
2016-07-23 05:46:02 -07:00
|
|
|
@test "local should overwrite the existing version if it's set" {
|
|
|
|
echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0"
|
2016-04-24 08:11:33 -07:00
|
|
|
[ "$status" -eq 0 ]
|
2016-07-23 05:46:02 -07:00
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0" ]
|
|
|
|
}
|
2016-04-24 08:11:33 -07:00
|
|
|
|
2016-12-18 23:25:29 -07:00
|
|
|
@test "local should fail to set a path:dir if dir does not exists " {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "path:$PROJECT_DIR/local"
|
|
|
|
[ "$output" = "version path:$PROJECT_DIR/local is not installed for dummy" ]
|
|
|
|
[ "$status" -eq 1 ]
|
2016-12-18 23:25:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "local should set a path:dir if dir exists " {
|
2019-01-20 01:13:20 -07:00
|
|
|
mkdir -p $PROJECT_DIR/local
|
|
|
|
run asdf local "dummy" "path:$PROJECT_DIR/local"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy path:$PROJECT_DIR/local" ]
|
2016-12-18 23:25:29 -07:00
|
|
|
}
|
|
|
|
|
2018-10-18 19:09:23 -07:00
|
|
|
@test "local -p/--parent should set should emit an error when called with incorrect arity" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local -p "dummy"
|
2018-10-18 19:09:23 -07:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
[ "$output" = "Usage: asdf local <name> <version>" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local -p/--parent should emit an error when plugin does not exist" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local -p "inexistent" "1.0.0"
|
2018-10-18 19:09:23 -07:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
[ "$output" = "No such plugin: inexistent" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local -p/--parent should emit an error when plugin version does not exist" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local -p "dummy" "0.0.1"
|
2018-10-18 19:09:23 -07:00
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
[ "$output" = "version 0.0.1 is not installed for dummy" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local -p/--parent should allow multiple versions" {
|
|
|
|
cd $CHILD_DIR
|
2018-10-19 17:29:31 -07:00
|
|
|
touch $PROJECT_DIR/.tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local -p "dummy" "1.1.0" "1.0.0"
|
2018-10-18 19:09:23 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0 1.0.0" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local -p/--parent should overwrite the existing version if it's set" {
|
|
|
|
cd $CHILD_DIR
|
|
|
|
echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local -p "dummy" "1.1.0"
|
2018-10-18 19:09:23 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local -p/--parent should set the version if it's unset" {
|
|
|
|
cd $CHILD_DIR
|
2018-10-19 17:29:31 -07:00
|
|
|
touch $PROJECT_DIR/.tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local -p "dummy" "1.1.0"
|
2018-10-18 19:09:23 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.1.0" ]
|
|
|
|
}
|
|
|
|
|
2016-07-23 05:46:02 -07:00
|
|
|
@test "global should create a global .tool-versions file if it doesn't exist" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "1.1.0"
|
2016-04-24 08:11:33 -07:00
|
|
|
[ "$status" -eq 0 ]
|
2016-07-23 05:46:02 -07:00
|
|
|
[ "$(cat $HOME/.tool-versions)" = "dummy 1.1.0" ]
|
|
|
|
}
|
2016-04-24 08:11:33 -07:00
|
|
|
|
2016-08-29 23:46:14 -07:00
|
|
|
@test "global should accept multiple versions" {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "1.1.0" "1.0.0"
|
2016-08-29 23:46:14 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $HOME/.tool-versions)" = "dummy 1.1.0 1.0.0" ]
|
|
|
|
}
|
|
|
|
|
2016-07-23 05:46:02 -07:00
|
|
|
@test "global should overwrite the existing version if it's set" {
|
|
|
|
echo 'dummy 1.0.0' >> $HOME/.tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "1.1.0"
|
2016-04-24 08:11:33 -07:00
|
|
|
[ "$status" -eq 0 ]
|
2016-07-23 05:46:02 -07:00
|
|
|
[ "$(cat $HOME/.tool-versions)" = "dummy 1.1.0" ]
|
2016-04-24 08:11:33 -07:00
|
|
|
}
|
2016-12-18 23:25:29 -07:00
|
|
|
|
|
|
|
@test "global should fail to set a path:dir if dir does not exists " {
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "path:$PROJECT_DIR/local"
|
|
|
|
[ "$output" = "version path:$PROJECT_DIR/local is not installed for dummy" ]
|
|
|
|
[ "$status" -eq 1 ]
|
2016-12-18 23:25:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "global should set a path:dir if dir exists " {
|
2019-01-20 01:13:20 -07:00
|
|
|
mkdir -p $PROJECT_DIR/local
|
|
|
|
run asdf global "dummy" "path:$PROJECT_DIR/local"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $HOME/.tool-versions)" = "dummy path:$PROJECT_DIR/local" ]
|
2016-12-18 23:25:29 -07:00
|
|
|
}
|
2017-09-14 04:21:36 -07:00
|
|
|
|
|
|
|
@test "global should write to ASDF_DEFAULT_TOOL_VERSIONS_FILENAME" {
|
2019-01-20 01:13:20 -07:00
|
|
|
export ASDF_DEFAULT_TOOL_VERSIONS_FILENAME="$PROJECT_DIR/global-tool-versions"
|
|
|
|
run asdf global "dummy" "1.1.0"
|
2017-09-14 04:21:36 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $ASDF_DEFAULT_TOOL_VERSIONS_FILENAME)" = "dummy 1.1.0" ]
|
|
|
|
[ "$(cat $HOME/.tool-versions)" = "" ]
|
2019-01-20 01:13:20 -07:00
|
|
|
unset ASDF_DEFAULT_TOOL_VERSIONS_FILENAME
|
2017-09-14 04:21:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "global should overwrite contents of ASDF_DEFAULT_TOOL_VERSIONS_FILENAME if set" {
|
2019-01-20 01:13:20 -07:00
|
|
|
export ASDF_DEFAULT_TOOL_VERSIONS_FILENAME="$PROJECT_DIR/global-tool-versions"
|
2017-09-14 04:21:36 -07:00
|
|
|
echo 'dummy 1.0.0' >> "$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME"
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "1.1.0"
|
2017-09-14 04:21:36 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $ASDF_DEFAULT_TOOL_VERSIONS_FILENAME)" = "dummy 1.1.0" ]
|
|
|
|
[ "$(cat $HOME/.tool-versions)" = "" ]
|
2019-01-20 01:13:20 -07:00
|
|
|
unset ASDF_DEFAULT_TOOL_VERSIONS_FILENAME
|
2017-09-14 04:21:36 -07:00
|
|
|
}
|
2018-06-16 19:48:16 -07:00
|
|
|
|
|
|
|
@test "local should preserve symlinks when setting versions" {
|
|
|
|
mkdir other-dir
|
|
|
|
touch other-dir/.tool-versions
|
|
|
|
ln -s other-dir/.tool-versions .tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0"
|
2018-06-16 19:48:16 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ -L .tool-versions ]
|
|
|
|
[ "$(cat other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local should preserve symlinks when updating versions" {
|
|
|
|
mkdir other-dir
|
|
|
|
touch other-dir/.tool-versions
|
|
|
|
ln -s other-dir/.tool-versions .tool-versions
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf local "dummy" "1.1.0"
|
|
|
|
run asdf local "dummy" "1.1.0"
|
2018-06-16 19:48:16 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ -L .tool-versions ]
|
|
|
|
[ "$(cat other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "global should preserve symlinks when setting versions" {
|
2020-10-08 06:59:50 -07:00
|
|
|
mkdir $HOME/other-dir
|
|
|
|
touch $HOME/other-dir/.tool-versions
|
2018-06-16 19:48:16 -07:00
|
|
|
ln -s other-dir/.tool-versions $HOME/.tool-versions
|
|
|
|
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "1.1.0"
|
2018-06-16 19:48:16 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ -L $HOME/.tool-versions ]
|
2020-10-08 06:59:50 -07:00
|
|
|
[ "$(cat $HOME/other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
2018-06-16 19:48:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "global should preserve symlinks when updating versions" {
|
2020-10-08 06:59:50 -07:00
|
|
|
mkdir $HOME/other-dir
|
|
|
|
touch $HOME/other-dir/.tool-versions
|
2018-06-16 19:48:16 -07:00
|
|
|
ln -s other-dir/.tool-versions $HOME/.tool-versions
|
|
|
|
|
2019-01-20 01:13:20 -07:00
|
|
|
run asdf global "dummy" "1.1.0"
|
|
|
|
run asdf global "dummy" "1.1.0"
|
2018-06-16 19:48:16 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ -L $HOME/.tool-versions ]
|
2020-10-08 06:59:50 -07:00
|
|
|
[ "$(cat $HOME/other-dir/.tool-versions)" = "dummy 1.1.0" ]
|
2018-06-16 19:48:16 -07:00
|
|
|
}
|
2019-03-09 10:30:31 -07:00
|
|
|
|
|
|
|
@test "shell wrapper function should export ENV var" {
|
2021-05-21 09:03:06 -07:00
|
|
|
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
|
2019-03-09 10:30:31 -07:00
|
|
|
asdf shell "dummy" "1.1.0"
|
|
|
|
[ $(echo $ASDF_DUMMY_VERSION) = "1.1.0" ]
|
|
|
|
unset ASDF_DUMMY_VERSION
|
|
|
|
}
|
|
|
|
|
2019-08-17 06:46:00 -07:00
|
|
|
@test "shell wrapper function with --unset should unset ENV var" {
|
2021-05-21 09:03:06 -07:00
|
|
|
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
|
2019-08-17 06:46:00 -07:00
|
|
|
asdf shell "dummy" "1.1.0"
|
|
|
|
[ $(echo $ASDF_DUMMY_VERSION) = "1.1.0" ]
|
2019-09-01 19:55:42 -07:00
|
|
|
asdf shell "dummy" --unset
|
2019-08-17 06:46:00 -07:00
|
|
|
[ -z "$(echo $ASDF_DUMMY_VERSION)" ]
|
|
|
|
unset ASDF_DUMMY_VERSION
|
|
|
|
}
|
|
|
|
|
2019-03-09 10:30:31 -07:00
|
|
|
@test "shell wrapper function should return an error for missing plugins" {
|
2021-05-21 09:03:06 -07:00
|
|
|
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
|
2020-08-28 16:09:22 -07:00
|
|
|
expected="No such plugin: nonexistent
|
|
|
|
version 1.0.0 is not installed for nonexistent"
|
|
|
|
|
2019-03-09 10:30:31 -07:00
|
|
|
run asdf shell "nonexistent" "1.0.0"
|
|
|
|
[ "$status" -eq 1 ]
|
2020-08-28 16:09:22 -07:00
|
|
|
[ "$output" = "$expected" ]
|
2019-03-09 10:30:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "shell should emit an error when wrapper function is not loaded" {
|
|
|
|
run asdf shell "dummy" "1.1.0"
|
|
|
|
[ "$status" -eq 1 ]
|
|
|
|
[ "$output" = "Shell integration is not enabled. Please ensure you source asdf in your shell setup." ]
|
|
|
|
}
|
|
|
|
|
2019-11-27 01:24:29 -07:00
|
|
|
@test "export-shell-version should emit an error when plugin does not exist" {
|
2020-08-28 16:09:22 -07:00
|
|
|
expected="No such plugin: nonexistent
|
|
|
|
version 1.0.0 is not installed for nonexistent
|
|
|
|
false"
|
|
|
|
|
2019-11-27 01:24:29 -07:00
|
|
|
run asdf export-shell-version sh "nonexistent" "1.0.0"
|
2019-03-09 10:30:31 -07:00
|
|
|
[ "$status" -eq 1 ]
|
2020-08-28 16:09:22 -07:00
|
|
|
[ "$output" = "$expected" ]
|
2019-03-09 10:30:31 -07:00
|
|
|
}
|
|
|
|
|
2019-11-27 01:24:29 -07:00
|
|
|
@test "export-shell-version should emit an error when version does not exist" {
|
2020-08-28 16:09:22 -07:00
|
|
|
expected="version nonexistent is not installed for dummy
|
|
|
|
false"
|
|
|
|
|
2019-11-27 01:24:29 -07:00
|
|
|
run asdf export-shell-version sh "dummy" "nonexistent"
|
2019-03-09 10:30:31 -07:00
|
|
|
[ "$status" -eq 1 ]
|
2020-08-28 16:09:22 -07:00
|
|
|
[ "$output" = "$expected" ]
|
2019-03-09 10:30:31 -07:00
|
|
|
}
|
|
|
|
|
2019-11-27 01:24:29 -07:00
|
|
|
@test "export-shell-version should export version if it exists" {
|
|
|
|
run asdf export-shell-version sh "dummy" "1.1.0"
|
2019-03-09 10:30:31 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "export ASDF_DUMMY_VERSION=\"1.1.0\"" ]
|
|
|
|
}
|
|
|
|
|
2019-11-27 01:24:29 -07:00
|
|
|
@test "export-shell-version should use set when shell is fish" {
|
|
|
|
run asdf export-shell-version fish "dummy" "1.1.0"
|
2019-03-09 10:30:31 -07:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "set -gx ASDF_DUMMY_VERSION \"1.1.0\"" ]
|
|
|
|
}
|
2020-01-25 13:35:36 -07:00
|
|
|
|
|
|
|
@test "export-shell-version should unset when --unset flag is passed" {
|
|
|
|
run asdf export-shell-version sh "dummy" "--unset"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "unset ASDF_DUMMY_VERSION" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "export-shell-version should use set -e when --unset flag is passed and shell is fish" {
|
|
|
|
run asdf export-shell-version fish "dummy" "--unset"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "set -e ASDF_DUMMY_VERSION" ]
|
|
|
|
}
|
2020-09-18 22:37:52 -07:00
|
|
|
|
|
|
|
@test "shell wrapper function should support latest" {
|
2021-05-21 09:03:06 -07:00
|
|
|
. $(dirname "$BATS_TEST_DIRNAME")/asdf.sh
|
2020-09-18 22:37:52 -07:00
|
|
|
asdf shell "dummy" "latest"
|
|
|
|
[ $(echo $ASDF_DUMMY_VERSION) = "2.0.0" ]
|
|
|
|
unset ASDF_DUMMY_VERSION
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "global should support latest" {
|
|
|
|
echo 'dummy 1.0.0' >> $HOME/.tool-versions
|
|
|
|
run asdf global "dummy" "1.0.0" "latest"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $HOME/.tool-versions)" = "dummy 1.0.0 2.0.0" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "local should support latest" {
|
|
|
|
echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions
|
|
|
|
run asdf local "dummy" "1.0.0" "latest"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.0.0 2.0.0" ]
|
|
|
|
}
|