mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Implemented tests for shim generation only for executable files, not directories.
This commit is contained in:
parent
28c0576d17
commit
20bb61963d
1
test/fixtures/dummy_plugin/bin/install
vendored
1
test/fixtures/dummy_plugin/bin/install
vendored
@ -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"
|
@ -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
|
||||
|
@ -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)" ]
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user