mirror of
				https://github.com/tmux-plugins/tpm.git
				synced 2025-11-04 08:36:05 +00:00 
			
		
		
		
	Enable removing plugins via CLI executable
This commit is contained in:
		@@ -14,16 +14,49 @@ manually_install_the_plugin() {
 | 
			
		||||
	git clone --quiet https://github.com/tmux-plugins/tmux-example-plugin
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
test_plugin_uninstallation() {
 | 
			
		||||
# TMUX KEY-BINDING TESTS
 | 
			
		||||
 | 
			
		||||
test_plugin_uninstallation_via_tmux_key_binding() {
 | 
			
		||||
	set_tmux_conf_helper <<- HERE
 | 
			
		||||
	run-shell "$TPM_DIR/tpm"
 | 
			
		||||
	HERE
 | 
			
		||||
 | 
			
		||||
	manually_install_the_plugin
 | 
			
		||||
 | 
			
		||||
	# opens tmux and test it with `expect`
 | 
			
		||||
	"$CURRENT_DIR/expect_successful_clean_plugins" ||
 | 
			
		||||
		fail_helper "Clean fails"
 | 
			
		||||
		fail_helper "[key-binding] clean fails"
 | 
			
		||||
 | 
			
		||||
	teardown_helper
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# SCRIPT TESTS
 | 
			
		||||
 | 
			
		||||
test_plugin_uninstallation_via_script() {
 | 
			
		||||
	set_tmux_conf_helper <<- HERE
 | 
			
		||||
	run-shell "$TPM_DIR/tpm"
 | 
			
		||||
	HERE
 | 
			
		||||
 | 
			
		||||
	manually_install_the_plugin
 | 
			
		||||
 | 
			
		||||
	script_run_helper "$TPM_DIR/bin/clean_plugins" '"tmux-example-plugin" clean success' ||
 | 
			
		||||
		fail_helper "[script] plugin cleaning fails"
 | 
			
		||||
 | 
			
		||||
	teardown_helper
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
test_unsuccessful_plugin_uninstallation_via_script() {
 | 
			
		||||
	set_tmux_conf_helper <<- HERE
 | 
			
		||||
	run-shell "$TPM_DIR/tpm"
 | 
			
		||||
	HERE
 | 
			
		||||
 | 
			
		||||
	manually_install_the_plugin
 | 
			
		||||
	chmod 000 "$PLUGINS_DIR/tmux-example-plugin" # disable directory deletion
 | 
			
		||||
 | 
			
		||||
	local expected_exit_code=1
 | 
			
		||||
	script_run_helper "$TPM_DIR/bin/clean_plugins" '"tmux-example-plugin" clean fail' "$expected_exit_code" ||
 | 
			
		||||
		fail_helper "[script] unsuccessful plugin cleaning doesn't fail"
 | 
			
		||||
 | 
			
		||||
	chmod 755 "$PLUGINS_DIR/tmux-example-plugin" # enable directory deletion
 | 
			
		||||
 | 
			
		||||
	teardown_helper
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user