From 11f86e77b06ac561802fed2a28559dbc7d3171f6 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 22 Jan 2014 08:33:43 +0400 Subject: [PATCH] Add fish tests --- tests/install.sh | 2 +- tests/test_shells/fish.ok | 10 ++++++++++ tests/test_shells/input.fish | 15 +++++++++++++++ tests/test_shells/test.sh | 21 ++++++++++++++------- 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 tests/test_shells/fish.ok create mode 100644 tests/test_shells/input.fish diff --git a/tests/install.sh b/tests/install.sh index 24ad4a22..20ddf745 100755 --- a/tests/install.sh +++ b/tests/install.sh @@ -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 diff --git a/tests/test_shells/fish.ok b/tests/test_shells/fish.ok new file mode 100644 index 00000000..428a9d9b --- /dev/null +++ b/tests/test_shells/fish.ok @@ -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⏎ \ No newline at end of file diff --git a/tests/test_shells/input.fish b/tests/test_shells/input.fish new file mode 100644 index 00000000..658d4899 --- /dev/null +++ b/tests/test_shells/input.fish @@ -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 diff --git a/tests/test_shells/test.sh b/tests/test_shells/test.sh index f47ab5a5..d2350190 100755 --- a/tests/test_shells/test.sh +++ b/tests/test_shells/test.sh @@ -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