Tests non-existing plugin installation

travis_install_tmux_from_source
Bruno Sutic 8 years ago
parent 7ff8de38a4
commit d19c187dcc
No known key found for this signature in database
GPG Key ID: 66D96E4F2F7EF26C
  1. 41
      tests/expect_failed_plugin_download
  2. 2
      tests/helpers/tpm.sh
  3. 25
      tests/test_plugin_installation.sh

@ -0,0 +1,41 @@
#!/usr/bin/env expect
# disables script output
log_user 0
spawn tmux
# Waiting for tmux to attach. If this is not done, next command, `send` will
# not work properly.
sleep 1
# this is tmux prefix + I
send "I"
# cloning might take a while
set timeout 20
expect_after {
timeout {
puts "Plugin installation timeout"
exit 1
}
}
expect {
"Installing \"non-existing-plugin\"" {
expect {
"\"non-existing-plugin\" download fail" {
expect {
"Done, press ENTER to continue" {
exit
}
}
}
}
}
}

@ -7,7 +7,7 @@ script_run_helper() {
local script="$1"
local expected_output="$2"
local expected_exit_code="${3:-0}"
$script |
$script 2>&1 |
grep "$expected_output" >/dev/null 2>&1 && # grep -q flag quits the script early
[ "${PIPESTATUS[0]}" -eq "$expected_exit_code" ]
}

@ -44,6 +44,18 @@ test_plugin_installation_custom_dir_via_tmux_key_binding() {
rm -rf "$CUSTOM_PLUGINS_DIR"
}
test_non_existing_plugin_installation_via_tmux_key_binding() {
set_tmux_conf_helper <<- HERE
set -g @plugin "tmux-plugins/non-existing-plugin"
run-shell "$TPM_DIR/tpm"
HERE
"$CURRENT_DIR/expect_failed_plugin_download" ||
fail_helper "[key-binding] non existing plugin installation doesn't fail"
teardown_helper
}
test_multiple_plugins_installation_via_tmux_key_binding() {
set_tmux_conf_helper <<- HERE
set -g @plugin "tmux-plugins/tmux-example-plugin"
@ -105,6 +117,19 @@ test_plugin_installation_custom_dir_via_script() {
rm -rf "$CUSTOM_PLUGINS_DIR"
}
test_non_existing_plugin_installation_via_script() {
set_tmux_conf_helper <<- HERE
set -g @plugin "tmux-plugins/non-existing-plugin"
run-shell "$TPM_DIR/tpm"
HERE
local expected_exit_code=1
script_run_helper "$TPM_DIR/bin/install_plugins" '"non-existing-plugin" download fail' "$expected_exit_code" ||
fail_helper "[script] non existing plugin installation doesn't fail"
teardown_helper
}
test_multiple_plugins_installation_via_script() {
set_tmux_conf_helper <<- HERE
set -g @plugin "tmux-plugins/tmux-example-plugin"

Loading…
Cancel
Save