Add fish tests

This commit is contained in:
ZyX 2014-01-22 08:33:43 +04:00
parent 461c4f4d51
commit 11f86e77b0
4 changed files with 40 additions and 8 deletions

View File

@ -9,5 +9,5 @@ if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
pip install unittest2 argparse
fi
fi
sudo apt-get install -qq zsh screen
sudo apt-get install -qq screen zsh fish
true

10
tests/test_shells/fish.ok Normal file
View File

@ -0,0 +1,10 @@
]0;source /home/USER/.vam/powerline-dev]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd .git
]0;cd /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd/.git⏎   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
]0;cd /home/USER/.vam/powerline-dev/tests/shell/3rd/.git]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  set VIRTUAL_ENV "$HOME/.virtenvs/some-virtual-environment"
]0;set /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  set VIRTUAL_ENV
]0;set /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done" &
]0;bash /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
]0;false /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill (cat pid) ; sleep 1s
]0;kill /home/USER/.vam/powerline-dev/tests/shell/3rdfish: Job 1, “bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done" &” terminated by signal SIGTERM (Polite quit request)
]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  false
]0;false /home/USER/.vam/powerline-dev/tests/shell/3rd]0;fish /home/USER/.vam/powerline-dev/tests/shell/3rd⏎

View File

@ -0,0 +1,15 @@
set POWERLINE_COMMAND "$PWD/scripts/powerline -p $PWD/powerline/config_files"
set POWERLINE_COMMAND "$POWERLINE_COMMAND -t default_leftonly.segment_data.hostname.args.only_if_ssh=false"
set POWERLINE_COMMAND "$POWERLINE_COMMAND -c ext.shell.theme=default_leftonly"
set VIRTUAL_ENV
source powerline/bindings/fish/powerline.fish ; cd tests/shell/3rd
cd .git
cd ..
set VIRTUAL_ENV "$HOME/.virtenvs/some-virtual-environment"
set VIRTUAL_ENV
bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done" &
false
kill (cat pid) ; sleep 1s
false
true is the last line
exit

View File

@ -12,9 +12,13 @@ else
fi
check_screen_log() {
diff -u tests/test_shells/${1}.ok tests/shell/screen.log
# Explicit is better then implicit
return $?
if test -e tests/test_shells/${1}.ok ; then
diff -u tests/test_shells/${1}.ok tests/shell/screen.log
return $?
else
cat tests/shell/screen.log
return 1
fi
}
run_test() {
@ -37,6 +41,7 @@ run_test() {
if ! check_screen_log ${SH} ; then
# Repeat the diff to make it better viewable in travis output
check_screen_log ${SH} | cat -v
echo "Failed ${SH}"
return 1
fi
return 0
@ -47,17 +52,19 @@ git init tests/shell/3rd
git --git-dir=tests/shell/3rd/.git checkout -b BRANCH
if ! run_test bash --norc --noprofile -i ; then
echo "Failed bash"
FAILED=1
fi
cp tests/shell/screen.log tests/bash.log
rm tests/shell/screen.log
if ! run_test zsh -f -i ; then
echo "Failed zsh"
FAILED=1
fi
cp tests/shell/screen.log tests/zsh.log
rm tests/shell/screen.log
export XDG_CONFIG_HOME=/dev/null
if ! run_test fish -i ; then
FAILED=1
fi
rm tests/shell/screen.log
rm -r tests/shell