mirror of
https://github.com/tmux-plugins/tpm.git
synced 2024-11-16 09:28:47 +00:00
Change indentation to tabs
This commit is contained in:
parent
c1304d1da0
commit
89ea56f553
14
test/run
14
test/run
@ -3,21 +3,21 @@
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
run_vagrant() {
|
||||
vagrant up --provider=docker
|
||||
vagrant up --provider=docker
|
||||
}
|
||||
|
||||
stop_vagrant() {
|
||||
vagrant destroy -f
|
||||
vagrant destroy -f
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
# actually this test file should be run inside vagrant
|
||||
$CURRENT_DIR/tests/test_plugin_installation.sh
|
||||
# actually this test file should be run inside vagrant
|
||||
$CURRENT_DIR/tests/test_plugin_installation.sh
|
||||
}
|
||||
|
||||
main() {
|
||||
run_vagrant
|
||||
run_tests
|
||||
stop_vagrant
|
||||
run_vagrant
|
||||
run_tests
|
||||
stop_vagrant
|
||||
}
|
||||
main
|
||||
|
@ -1,46 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set_tmux_conf_helper() {
|
||||
> ~/.tmux.conf # empty filename
|
||||
while read -r line; do
|
||||
echo $line >> ~/.tmux.conf
|
||||
done
|
||||
> ~/.tmux.conf # empty filename
|
||||
while read -r line; do
|
||||
echo $line >> ~/.tmux.conf
|
||||
done
|
||||
}
|
||||
|
||||
create_test_plugin_helper() {
|
||||
local plugin_path="$HOME/.tmux/plugins/tmux_test_plugin/"
|
||||
rm -rf $plugin_path
|
||||
mkdir -p $plugin_path
|
||||
local plugin_path="$HOME/.tmux/plugins/tmux_test_plugin/"
|
||||
rm -rf $plugin_path
|
||||
mkdir -p $plugin_path
|
||||
|
||||
while read -r line; do
|
||||
echo $line >> "$plugin_path/test_plugin.tmux"
|
||||
done
|
||||
chmod +x "$plugin_path/test_plugin.tmux"
|
||||
while read -r line; do
|
||||
echo $line >> "$plugin_path/test_plugin.tmux"
|
||||
done
|
||||
chmod +x "$plugin_path/test_plugin.tmux"
|
||||
}
|
||||
|
||||
teardown_helper() {
|
||||
rm ~/.tmux.conf
|
||||
rm -rf ~/.tmux/
|
||||
tmux kill-server >/dev/null 2>&1
|
||||
rm ~/.tmux.conf
|
||||
rm -rf ~/.tmux/
|
||||
tmux kill-server >/dev/null 2>&1
|
||||
}
|
||||
|
||||
check_dir_exists_helper() {
|
||||
local dir_path=$1
|
||||
if [ -d "$dir_path" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
local dir_path=$1
|
||||
if [ -d "$dir_path" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
exit_value_helper() {
|
||||
if $FAIL; then
|
||||
echo
|
||||
echo "Test failed"
|
||||
exit 1
|
||||
else
|
||||
echo
|
||||
echo "Test finished successfully"
|
||||
exit 0
|
||||
fi
|
||||
if $FAIL; then
|
||||
echo
|
||||
echo "Test failed"
|
||||
exit 1
|
||||
else
|
||||
echo
|
||||
echo "Test finished successfully"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
@ -12,19 +12,19 @@ test_plugin_installation() {
|
||||
run-shell '~/tmux_plugin_manager/tpm'
|
||||
HERE
|
||||
|
||||
# opens tmux and test it with `expect`
|
||||
$CURRENT_DIR/expect_successful_plugin_download ||
|
||||
(echo "Tmux plugin installation fails" >&2; FAIL=true)
|
||||
# opens tmux and test it with `expect`
|
||||
$CURRENT_DIR/expect_successful_plugin_download ||
|
||||
(echo "Tmux plugin installation fails" >&2; FAIL=true)
|
||||
|
||||
# check plugin dir exists after download
|
||||
check_dir_exists_helper "/root/.tmux/plugins/tmux_example_plugin/" ||
|
||||
(echo "Plugin download fails" >&2; FAIL=true)
|
||||
# check plugin dir exists after download
|
||||
check_dir_exists_helper "/root/.tmux/plugins/tmux_example_plugin/" ||
|
||||
(echo "Plugin download fails" >&2; FAIL=true)
|
||||
|
||||
teardown_helper
|
||||
}
|
||||
|
||||
main() {
|
||||
test_plugin_installation
|
||||
exit_value_helper
|
||||
test_plugin_installation
|
||||
exit_value_helper
|
||||
}
|
||||
main
|
||||
|
@ -7,8 +7,8 @@ source $CURRENT_DIR/helpers.sh
|
||||
export FAIL=false
|
||||
|
||||
check_binding_defined() {
|
||||
local binding=$1
|
||||
tmux list-keys | grep -q "$binding"
|
||||
local binding=$1
|
||||
tmux list-keys | grep -q "$binding"
|
||||
}
|
||||
|
||||
test_plugin_sourcing() {
|
||||
@ -22,15 +22,15 @@ test_plugin_sourcing() {
|
||||
tmux bind-key R run-shell foo_command
|
||||
HERE
|
||||
|
||||
tmux new-session -d # tmux starts detached
|
||||
check_binding_defined 'R run-shell foo_command' ||
|
||||
(echo "Plugin sourcing fails" >&2; FAIL=true)
|
||||
tmux new-session -d # tmux starts detached
|
||||
check_binding_defined 'R run-shell foo_command' ||
|
||||
(echo "Plugin sourcing fails" >&2; FAIL=true)
|
||||
|
||||
teardown_helper
|
||||
}
|
||||
|
||||
main() {
|
||||
test_plugin_sourcing
|
||||
exit_value_helper
|
||||
test_plugin_sourcing
|
||||
exit_value_helper
|
||||
}
|
||||
main
|
||||
|
Loading…
Reference in New Issue
Block a user