mirror of
https://github.com/tmux-plugins/tpm.git
synced 2024-12-04 18:58:49 +00:00
Improve tests
This commit is contained in:
parent
5bbe60dc42
commit
9eee9c06b6
46
tests/expect_successful_multiple_plugins_download
Executable file
46
tests/expect_successful_multiple_plugins_download
Executable file
@ -0,0 +1,46 @@
|
||||
#!/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 15
|
||||
|
||||
expect { "Installing \"tmux-example-plugin\"" {
|
||||
|
||||
expect { "\"tmux-example-plugin\" download success" {
|
||||
|
||||
expect { "Installing \"tmux-copycat\"" {
|
||||
|
||||
expect { "\"tmux-copycat\" download success" {
|
||||
|
||||
expect { "Done, press ENTER to continue" {
|
||||
send "
"
|
||||
}
|
||||
} # Done, press ENTER to continue
|
||||
|
||||
}
|
||||
} # "tmux-copycat" download success
|
||||
|
||||
}
|
||||
} # Installing "tmux-copycat"
|
||||
|
||||
}
|
||||
} # "tmux-example-plugin" download success
|
||||
|
||||
}
|
||||
|
||||
timeout {
|
||||
puts "Multiple plugins installation timeout";
|
||||
exit 1
|
||||
}
|
||||
}
|
@ -6,12 +6,12 @@ source $CURRENT_DIR/helpers.sh
|
||||
|
||||
test_plugin_installation() {
|
||||
set_tmux_conf_helper <<- HERE
|
||||
set -g @tpm_plugins "tmux-plugins/tmux-example-plugin"
|
||||
set @plugin "tmux-plugins/tmux-example-plugin"
|
||||
run-shell "$PWD/tpm"
|
||||
HERE
|
||||
|
||||
# opens tmux and test it with `expect`
|
||||
$CURRENT_DIR/expect_successful_plugin_download ||
|
||||
"$CURRENT_DIR"/expect_successful_plugin_download ||
|
||||
fail_helper "Tmux plugin installation fails"
|
||||
|
||||
# check plugin dir exists after download
|
||||
@ -21,8 +21,30 @@ test_plugin_installation() {
|
||||
teardown_helper
|
||||
}
|
||||
|
||||
test_multiple_plugins_installation() {
|
||||
set_tmux_conf_helper <<- HERE
|
||||
set @plugin "tmux-plugins/tmux-example-plugin"
|
||||
set @plugin 'tmux-plugins/tmux-copycat'
|
||||
run-shell "$PWD/tpm"
|
||||
HERE
|
||||
|
||||
# opens tmux and test it with `expect`
|
||||
"$CURRENT_DIR"/expect_successful_multiple_plugins_download ||
|
||||
fail_helper "Tmux multiple plugins installation fails"
|
||||
|
||||
# check plugin dir exists after download
|
||||
check_dir_exists_helper "$HOME/.tmux/plugins/tmux-example-plugin/" ||
|
||||
fail_helper "Plugin download fails (tmux-example-plugin)"
|
||||
|
||||
check_dir_exists_helper "$HOME/.tmux/plugins/tmux-copycat/" ||
|
||||
fail_helper "Plugin download fails (tmux-copycat)"
|
||||
|
||||
teardown_helper
|
||||
}
|
||||
|
||||
main() {
|
||||
test_plugin_installation
|
||||
test_multiple_plugins_installation
|
||||
exit_value_helper
|
||||
}
|
||||
main
|
||||
|
@ -6,12 +6,12 @@ source $CURRENT_DIR/helpers.sh
|
||||
|
||||
test_plugin_installation() {
|
||||
set_tmux_conf_helper <<- HERE
|
||||
set @plugin "tmux-plugins/tmux-example-plugin"
|
||||
set -g @tpm_plugins "tmux-plugins/tmux-example-plugin"
|
||||
run-shell "$PWD/tpm"
|
||||
HERE
|
||||
|
||||
# opens tmux and test it with `expect`
|
||||
"$CURRENT_DIR"/expect_successful_plugin_download ||
|
||||
$CURRENT_DIR/expect_successful_plugin_download ||
|
||||
fail_helper "Tmux plugin installation fails"
|
||||
|
||||
# check plugin dir exists after download
|
Loading…
Reference in New Issue
Block a user