Test produced shims by actually running them.

Test using a dummy executable.

Closes #127
This commit is contained in:
Victor Borja 2016-12-13 13:32:49 -06:00 committed by Stratus3D
parent 218a46d6f0
commit 10004e869c
2 changed files with 12 additions and 6 deletions

View File

@ -7,6 +7,6 @@ echo $ASDF_INSTALL_VERSION > $ASDF_INSTALL_PATH/version
# create the dummy executable
mkdir -p $ASDF_INSTALL_PATH/bin
cat <<EOF > $ASDF_INSTALL_PATH/bin/dummy
exec echo dummy
echo This is Dummy ${ASDF_INSTALL_VERSION}! \$2 \$1
EOF
chmod 755 $ASDF_INSTALL_PATH/bin/dummy
chmod +x $ASDF_INSTALL_PATH/bin/dummy

View File

@ -52,9 +52,15 @@ teardown() {
}
@test "install_command running a shim should call the plugin executable" {
run install_command dummy 1.0
@test "install_command generated shim should pass all arguments to executable" {
# asdf lib needed to run generated shims
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
cd $PROJECT_DIR
echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions
run install_command
# execute the generated shim
[ "$($ASDF_DIR/shims/dummy world hello)" == "This is Dummy 1.0! hello world" ]
[ "$status" -eq 0 ]
# run the shim which should be on path and expect the plugin's output
[ "dummy" $(dummy) ]
}