1
0
Fork 0
mirror of synced 2024-11-16 06:25:36 -05:00
tpm/tests/test_plugin_installation_legacy.sh

101 lines
3 KiB
Bash
Raw Normal View History

2015-05-27 15:27:01 -04:00
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2015-07-31 19:54:34 -04:00
PLUGINS_DIR="$HOME/.tmux/plugins"
TPM_DIR="$PWD"
2015-05-27 15:27:01 -04:00
2015-08-01 16:12:07 -04:00
source "$CURRENT_DIR/helpers/helpers.sh"
source "$CURRENT_DIR/helpers/tpm.sh"
2015-05-27 15:27:01 -04:00
# TMUX KEY-BINDING TESTS
test_plugin_installation_via_tmux_key_binding() {
2015-05-27 15:27:01 -04:00
set_tmux_conf_helper <<- HERE
set -g mode-keys vi
2015-06-02 16:47:32 -04:00
set -g @tpm_plugins "tmux-plugins/tmux-example-plugin"
2015-07-31 19:54:34 -04:00
run-shell "$TPM_DIR/tpm"
2015-05-27 15:27:01 -04:00
HERE
# opens tmux and test it with `expect`
2015-06-02 16:47:32 -04:00
$CURRENT_DIR/expect_successful_plugin_download ||
fail_helper "[key-binding] plugin installation fails"
2015-05-27 15:27:01 -04:00
# check plugin dir exists after download
2015-07-31 19:54:34 -04:00
check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" ||
fail_helper "[key-binding] plugin download fails"
2015-05-27 15:27:01 -04:00
teardown_helper
}
test_legacy_and_new_syntax_for_plugin_installation_work_via_tmux_key_binding() {
set_tmux_conf_helper <<- HERE
set -g mode-keys vi
set -g @tpm_plugins " \
tmux-plugins/tmux-example-plugin \
"
set -g @plugin 'tmux-plugins/tmux-copycat'
2015-07-31 19:54:34 -04:00
run-shell "$TPM_DIR/tpm"
HERE
# opens tmux and test it with `expect`
"$CURRENT_DIR"/expect_successful_multiple_plugins_download ||
fail_helper "[key-binding] multiple plugins installation fails"
# check plugin dir exists after download
2015-07-31 19:54:34 -04:00
check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" ||
fail_helper "[key-binding] plugin download fails (tmux-example-plugin)"
2015-07-31 19:54:34 -04:00
check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" ||
fail_helper "[key-binding] plugin download fails (tmux-copycat)"
teardown_helper
}
# SCRIPT TESTS
test_plugin_installation_via_script() {
set_tmux_conf_helper <<- HERE
set -g mode-keys vi
set -g @tpm_plugins "tmux-plugins/tmux-example-plugin"
2015-07-31 19:54:34 -04:00
run-shell "$TPM_DIR/tpm"
HERE
2015-07-31 19:54:34 -04:00
script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' ||
fail_helper "[script] plugin installation fails"
2015-07-31 19:54:34 -04:00
check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" ||
fail_helper "[script] plugin download fails"
2015-07-31 19:54:34 -04:00
script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-example-plugin"' ||
fail_helper "[script] plugin already installed message fail"
teardown_helper
}
test_legacy_and_new_syntax_for_plugin_installation_work_via_script() {
set_tmux_conf_helper <<- HERE
set -g mode-keys vi
set -g @tpm_plugins " \
tmux-plugins/tmux-example-plugin \
"
set -g @plugin 'tmux-plugins/tmux-copycat'
2015-07-31 19:54:34 -04:00
run-shell "$TPM_DIR/tpm"
HERE
2015-07-31 19:54:34 -04:00
script_run_helper "$TPM_DIR/bin/install_plugins" '"tmux-example-plugin" download success' ||
fail_helper "[script] multiple plugin installation fails"
2015-07-31 19:54:34 -04:00
check_dir_exists_helper "$PLUGINS_DIR/tmux-example-plugin/" ||
fail_helper "[script] plugin download fails (tmux-example-plugin)"
2015-07-31 19:54:34 -04:00
check_dir_exists_helper "$PLUGINS_DIR/tmux-copycat/" ||
fail_helper "[script] plugin download fails (tmux-copycat)"
2015-07-31 19:54:34 -04:00
script_run_helper "$TPM_DIR/bin/install_plugins" 'Already installed "tmux-copycat"' ||
fail_helper "[script] multiple plugins already installed message fail"
teardown_helper
}
2015-08-01 12:06:19 -04:00
run_tests