mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
Test produced shims by actually running them.
Test using a dummy executable. Closes #127
This commit is contained in:
parent
218a46d6f0
commit
10004e869c
4
test/fixtures/dummy_plugin/bin/install
vendored
4
test/fixtures/dummy_plugin/bin/install
vendored
@ -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
|
||||
|
@ -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) ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user