mirror of
https://github.com/tmux-plugins/tpm.git
synced 2024-12-04 18:58:49 +00:00
Add tests for updating plugins
This commit is contained in:
parent
08608064b2
commit
bfdbfa46b9
@ -12,6 +12,7 @@
|
||||
- installing plugins installs just new plugins. Already installed plugins aren't
|
||||
updated.
|
||||
- add 'update plugin' binding and functionality
|
||||
- add test for updating a plugin
|
||||
|
||||
### v0.0.2, 2014-07-17
|
||||
- run all *.tmux plugin files as executables
|
||||
|
61
tests/expect_successful_update_of_a_single_plugin
Executable file
61
tests/expect_successful_update_of_a_single_plugin
Executable file
@ -0,0 +1,61 @@
|
||||
#!/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 + U
|
||||
send "U"
|
||||
|
||||
set timeout 5
|
||||
|
||||
expect {
|
||||
"Installed plugins" {
|
||||
|
||||
expect {
|
||||
"\"tmux-example-plugin\"" {
|
||||
|
||||
expect {
|
||||
"\"all\" - updates all plugins" {
|
||||
|
||||
expect { "ENTER - cancels" }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
timeout {
|
||||
puts "Plugin update prompt timeout";
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
send "tmux-example-plugin\r"
|
||||
|
||||
expect {
|
||||
"Updating \"tmux-example-plugin\"" {
|
||||
|
||||
expect {
|
||||
"\"tmux-example-plugin\" update success" {
|
||||
|
||||
expect { "Done, press ENTER to continue." { exit 0 } }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
timeout {
|
||||
puts "Update all plugins timeout";
|
||||
exit 1
|
||||
}
|
||||
}
|
67
tests/expect_successful_update_of_all_plugins
Executable file
67
tests/expect_successful_update_of_all_plugins
Executable file
@ -0,0 +1,67 @@
|
||||
#!/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 + U
|
||||
send "U"
|
||||
|
||||
set timeout 5
|
||||
|
||||
expect {
|
||||
"Installed plugins" {
|
||||
|
||||
expect {
|
||||
"\"tmux-example-plugin\"" {
|
||||
|
||||
expect {
|
||||
"\"all\" - updates all plugins" {
|
||||
|
||||
expect { "ENTER - cancels" }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
timeout {
|
||||
puts "Plugin update prompt timeout";
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
send "all\r"
|
||||
|
||||
expect {
|
||||
"Updating all plugins!" {
|
||||
|
||||
expect {
|
||||
"Updating \"tmux-example-plugin\"" {
|
||||
|
||||
expect {
|
||||
"\"tmux-example-plugin\" update success" {
|
||||
|
||||
expect { "Done, press ENTER to continue." { exit 0 } }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
timeout {
|
||||
puts "Update all plugins timeout";
|
||||
exit 1
|
||||
}
|
||||
}
|
35
tests/test_plugin_update.sh
Executable file
35
tests/test_plugin_update.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source $CURRENT_DIR/helpers.sh
|
||||
|
||||
manually_install_the_plugin() {
|
||||
mkdir -p ~/.tmux/plugins/
|
||||
cd ~/.tmux/plugins/
|
||||
git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin
|
||||
}
|
||||
|
||||
test_plugin_installation() {
|
||||
set_tmux_conf_helper <<- HERE
|
||||
set -g @tpm_plugins "tmux-plugins/tmux-example-plugin"
|
||||
run-shell "~/tpm/tpm"
|
||||
HERE
|
||||
|
||||
manually_install_the_plugin
|
||||
|
||||
# opens tmux and test it with `expect`
|
||||
$CURRENT_DIR/expect_successful_update_of_all_plugins ||
|
||||
fail_helper "Tmux 'update all plugins' fails"
|
||||
|
||||
$CURRENT_DIR/expect_successful_update_of_a_single_plugin ||
|
||||
fail_helper "Tmux 'update single plugin' fails"
|
||||
|
||||
teardown_helper
|
||||
}
|
||||
|
||||
main() {
|
||||
test_plugin_installation
|
||||
exit_value_helper
|
||||
}
|
||||
main
|
Loading…
Reference in New Issue
Block a user