2017-03-15 20:57:15 -07:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load test_helpers
|
|
|
|
|
|
|
|
. $(dirname $BATS_TEST_DIRNAME)/lib/commands/which.sh
|
|
|
|
. $(dirname $BATS_TEST_DIRNAME)/lib/commands/install.sh
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
setup_asdf_dir
|
|
|
|
install_dummy_plugin
|
|
|
|
run install_command dummy 1.0
|
|
|
|
|
|
|
|
PROJECT_DIR=$HOME/project
|
|
|
|
mkdir $PROJECT_DIR
|
2018-10-20 20:47:13 -07:00
|
|
|
echo 'dummy 1.0' >> $PROJECT_DIR/.tool-versions
|
2017-03-15 20:57:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
teardown() {
|
|
|
|
clean_asdf_dir
|
|
|
|
}
|
|
|
|
|
2018-10-20 20:47:13 -07:00
|
|
|
@test "which should show dummy 1.0 main binary" {
|
2017-03-15 20:57:15 -07:00
|
|
|
cd $PROJECT_DIR
|
|
|
|
|
|
|
|
run which_command "dummy"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "$ASDF_DIR/installs/dummy/1.0/bin/dummy" ]
|
|
|
|
}
|
|
|
|
|
2018-10-20 20:47:13 -07:00
|
|
|
@test "which should show dummy 1.0 other binary" {
|
2018-02-25 16:34:39 -07:00
|
|
|
cd $PROJECT_DIR
|
|
|
|
|
2018-10-20 20:47:13 -07:00
|
|
|
run which_command "other_bin"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[ "$output" = "$ASDF_DIR/installs/dummy/1.0/bin/subdir/other_bin" ]
|
2018-02-25 16:34:39 -07:00
|
|
|
}
|
|
|
|
|
2018-10-20 20:47:13 -07:00
|
|
|
@test "which should inform when no binary is found" {
|
|
|
|
cd $PROJECT_DIR
|
|
|
|
|
|
|
|
run which_command "bazbat"
|
2017-03-15 20:57:15 -07:00
|
|
|
[ "$status" -eq 1 ]
|
2018-10-20 20:47:13 -07:00
|
|
|
[ "$output" = "No executable binary found for bazbat" ]
|
2017-03-15 20:57:15 -07:00
|
|
|
}
|