My configuration files for Debian/Ubuntu applications
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

test_plugin_update.sh 1.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. TPM_DIR="$PWD"
  4. PLUGINS_DIR="$HOME/.tmux/plugins"
  5. source "$CURRENT_DIR/helpers/helpers.sh"
  6. source "$CURRENT_DIR/helpers/tpm.sh"
  7. manually_install_the_plugin() {
  8. mkdir -p "$PLUGINS_DIR"
  9. cd "$PLUGINS_DIR"
  10. git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin
  11. }
  12. # TMUX KEY-BINDING TESTS
  13. test_plugin_update_via_tmux_key_binding() {
  14. set_tmux_conf_helper <<- HERE
  15. set -g mode-keys vi
  16. set -g @plugin "tmux-plugins/tmux-example-plugin"
  17. run-shell "$TPM_DIR/tpm"
  18. HERE
  19. manually_install_the_plugin
  20. "$CURRENT_DIR/expect_successful_update_of_all_plugins" ||
  21. fail_helper "[key-binding] 'update all plugins' fails"
  22. "$CURRENT_DIR/expect_successful_update_of_a_single_plugin" ||
  23. fail_helper "[key-binding] 'update single plugin' fails"
  24. teardown_helper
  25. }
  26. # SCRIPT TESTS
  27. test_plugin_update_via_script() {
  28. set_tmux_conf_helper <<- HERE
  29. set -g mode-keys vi
  30. set -g @plugin "tmux-plugins/tmux-example-plugin"
  31. run-shell "$TPM_DIR/tpm"
  32. HERE
  33. manually_install_the_plugin
  34. local expected_exit_code=1
  35. script_run_helper "$TPM_DIR/bin/update_plugins" 'usage' "$expected_exit_code" ||
  36. fail_helper "[script] running update plugins without args should fail"
  37. script_run_helper "$TPM_DIR/bin/update_plugins tmux-example-plugin" '"tmux-example-plugin" update success' ||
  38. fail_helper "[script] plugin update fails"
  39. script_run_helper "$TPM_DIR/bin/update_plugins all" '"tmux-example-plugin" update success' ||
  40. fail_helper "[script] update all plugins fails"
  41. teardown_helper
  42. }
  43. run_tests