mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Add test for invalid asdf install
arguments
This commit is contained in:
parent
5578b7849c
commit
d7e1e66c03
10
test/fixtures/dummy_plugin/bin/install
vendored
10
test/fixtures/dummy_plugin/bin/install
vendored
@ -1,5 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# We want certain versions to fail installation for various reasons in the tests
|
||||
check_dummy_versions() {
|
||||
local bad_versions=" other-dummy "
|
||||
if [[ "$bad_versions" == *" $ASDF_INSTALL_VERSION "* ]]; then
|
||||
echo "Dummy couldn't install version: $ASDF_INSTALL_VERSION (on purpose)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_dummy_versions
|
||||
mkdir -p "$ASDF_INSTALL_PATH"
|
||||
env >"$ASDF_INSTALL_PATH/env"
|
||||
echo "$ASDF_INSTALL_VERSION" >"$ASDF_INSTALL_PATH/version"
|
||||
|
@ -133,7 +133,6 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "install_command fails when tool is specified but no version of the tool is configured in config file" {
|
||||
|
||||
echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions
|
||||
run asdf install other-dummy
|
||||
[ "$status" -eq 1 ]
|
||||
@ -141,6 +140,15 @@ teardown() {
|
||||
[ ! -f $ASDF_DIR/installs/dummy/1.0/version ]
|
||||
}
|
||||
|
||||
@test "install_command fails when two tools are specified with no versions" {
|
||||
printf 'dummy 1.0\nother-dummy 2.0' > $PROJECT_DIR/.tool-versions
|
||||
run asdf install dummy other-dummy
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Dummy couldn't install version: other-dummy (on purpose)" ]
|
||||
[ ! -f $ASDF_DIR/installs/dummy/1.0/version ]
|
||||
[ ! -f $ASDF_DIR/installs/other-dummy/2.0/version ]
|
||||
}
|
||||
|
||||
@test "install_command without arguments uses a parent directory .tool-versions file if present" {
|
||||
# asdf lib needed to run generated shims
|
||||
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
|
||||
|
Loading…
Reference in New Issue
Block a user