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