2014-08-05 19:44:25 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2015-07-31 23:54:34 +00:00
|
|
|
TPM_DIR="$PWD"
|
|
|
|
PLUGINS_DIR="$HOME/.tmux/plugins"
|
2014-08-05 19:44:25 +00:00
|
|
|
|
2015-08-01 20:12:07 +00:00
|
|
|
source "$CURRENT_DIR/helpers/helpers.sh"
|
|
|
|
source "$CURRENT_DIR/helpers/tpm.sh"
|
2014-08-05 19:44:25 +00:00
|
|
|
|
|
|
|
manually_install_the_plugin() {
|
2015-07-31 23:54:34 +00:00
|
|
|
mkdir -p "$PLUGINS_DIR"
|
|
|
|
cd "$PLUGINS_DIR"
|
2014-08-05 19:44:25 +00:00
|
|
|
git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin
|
|
|
|
}
|
|
|
|
|
2015-08-01 22:41:06 +00:00
|
|
|
# TMUX KEY-BINDING TESTS
|
|
|
|
|
2015-08-02 20:53:03 +00:00
|
|
|
test_plugin_update_via_tmux_key_binding() {
|
2014-08-05 19:44:25 +00:00
|
|
|
set_tmux_conf_helper <<- HERE
|
2015-08-04 15:20:03 +00:00
|
|
|
set -g mode-keys vi
|
2015-07-06 23:49:33 +00:00
|
|
|
set -g @plugin "tmux-plugins/tmux-example-plugin"
|
2015-07-31 23:54:34 +00:00
|
|
|
run-shell "$TPM_DIR/tpm"
|
2014-08-05 19:44:25 +00:00
|
|
|
HERE
|
|
|
|
|
|
|
|
manually_install_the_plugin
|
|
|
|
|
2015-07-31 23:54:34 +00:00
|
|
|
"$CURRENT_DIR/expect_successful_update_of_all_plugins" ||
|
2015-08-01 22:41:06 +00:00
|
|
|
fail_helper "[key-binding] 'update all plugins' fails"
|
2014-08-05 19:44:25 +00:00
|
|
|
|
2015-07-31 23:54:34 +00:00
|
|
|
"$CURRENT_DIR/expect_successful_update_of_a_single_plugin" ||
|
2015-08-01 22:41:06 +00:00
|
|
|
fail_helper "[key-binding] 'update single plugin' fails"
|
|
|
|
|
|
|
|
teardown_helper
|
|
|
|
}
|
|
|
|
|
|
|
|
# SCRIPT TESTS
|
|
|
|
|
2015-08-02 20:53:03 +00:00
|
|
|
test_plugin_update_via_script() {
|
2015-08-01 22:41:06 +00:00
|
|
|
set_tmux_conf_helper <<- HERE
|
2015-08-04 15:20:03 +00:00
|
|
|
set -g mode-keys vi
|
2015-08-01 22:41:06 +00:00
|
|
|
set -g @plugin "tmux-plugins/tmux-example-plugin"
|
|
|
|
run-shell "$TPM_DIR/tpm"
|
|
|
|
HERE
|
|
|
|
|
|
|
|
manually_install_the_plugin
|
|
|
|
|
2015-08-02 20:51:45 +00:00
|
|
|
local expected_exit_code=1
|
|
|
|
script_run_helper "$TPM_DIR/bin/update_plugins" 'usage' "$expected_exit_code" ||
|
2015-08-01 22:41:06 +00:00
|
|
|
fail_helper "[script] running update plugins without args should fail"
|
|
|
|
|
|
|
|
script_run_helper "$TPM_DIR/bin/update_plugins tmux-example-plugin" '"tmux-example-plugin" update success' ||
|
|
|
|
fail_helper "[script] plugin update fails"
|
|
|
|
|
|
|
|
script_run_helper "$TPM_DIR/bin/update_plugins all" '"tmux-example-plugin" update success' ||
|
|
|
|
fail_helper "[script] update all plugins fails"
|
2014-08-05 19:44:25 +00:00
|
|
|
|
|
|
|
teardown_helper
|
|
|
|
}
|
|
|
|
|
2015-08-01 16:06:19 +00:00
|
|
|
run_tests
|