Implemented tests for shim generation only for executable files, not directories.

This commit is contained in:
Diego Nogueira Teixeira 2018-09-19 09:00:11 -03:00
parent 28c0576d17
commit 20bb61963d
3 changed files with 31 additions and 0 deletions

View File

@ -10,3 +10,4 @@ cat <<EOF > "$ASDF_INSTALL_PATH/bin/dummy"
echo This is Dummy ${ASDF_INSTALL_VERSION}! \$2 \$1
EOF
chmod +x "$ASDF_INSTALL_PATH/bin/dummy"
mkdir -p "$ASDF_INSTALL_PATH/bin/subdir"

View File

@ -72,6 +72,15 @@ teardown() {
[ "$lines_count" -eq "1" ]
}
@test "install_command should not generate shim for subdir" {
cd $PROJECT_DIR
echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions
run install_command
[ "$status" -eq 0 ]
[ -f "$ASDF_DIR/shims/dummy" ]
[ ! -f "$ASDF_DIR/shims/subdir" ]
}
@test "install_command generated shim should pass all arguments to executable" {
# asdf lib needed to run generated shims

View File

@ -67,3 +67,24 @@ teardown() {
[ "$status" -eq 0 ]
[ "1" -eq "$(ls $ASDF_DIR/shims/dummy* | wc -l)" ]
}
@test "reshim should create shims only for files and not folders" {
cd $PROJECT_DIR
run install_command dummy 1.0
run install_command dummy 1.1
[ "$status" -eq 0 ]
[ -f "$ASDF_DIR/shims/dummy" ]
[ ! -f "$ASDF_DIR/shims/subdir" ]
run rm $ASDF_DIR/shims/*
[ "$status" -eq 0 ]
[ "0" -eq "$(ls $ASDF_DIR/shims/dummy* | wc -l)" ]
[ "0" -eq "$(ls $ASDF_DIR/shims/subdir* | wc -l)" ]
run reshim_command dummy
[ "$status" -eq 0 ]
[ "1" -eq "$(ls $ASDF_DIR/shims/dummy* | wc -l)" ]
[ "0" -eq "$(ls $ASDF_DIR/shims/subdir* | wc -l)" ]
}