diff --git a/test/fixtures/dummy_plugin/bin/install b/test/fixtures/dummy_plugin/bin/install index d5170122..645f6ec6 100644 --- a/test/fixtures/dummy_plugin/bin/install +++ b/test/fixtures/dummy_plugin/bin/install @@ -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" diff --git a/test/install_command.bats b/test/install_command.bats index d4cecb39..2332841b 100644 --- a/test/install_command.bats +++ b/test/install_command.bats @@ -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/