Add support for testing zsh with zpython bindings

This commit is contained in:
ZyX 2015-01-02 03:43:57 +03:00
parent 2be849de44
commit f2fd92068e
6 changed files with 92 additions and 18 deletions

View File

@ -3,6 +3,10 @@
FAILED=0
if test "$PYTHON_IMPLEMENTATION" = "CPython" ; then
export PATH="/opt/zsh-${PYTHON_VERSION}/bin:${PATH}"
fi
if test -n "$USE_UCS2_PYTHON" ; then
export LD_LIBRARY_PATH=/opt/cpython-ucs2-$UCS2_PYTHON_VARIANT/lib
set +e

View File

@ -2,13 +2,31 @@ unset HOME
unsetopt promptsp notransientrprompt
setopt interactivecomments
setopt autonamedirs
# POWERLINE_CONFIG_PATH=$PWD/powerline/config_files
# POWERLINE_THEME_CONFIG=( default_leftonly.segment_data.hostname.args.only_if_ssh=false )
# POWERLINE_CONFIG=( ext.shell.theme=default_leftonly )
POWERLINE_NO_ZSH_ZPYTHON=1 # TODO: make tests work with zsh/zpython
if test -z "$POWERLINE_NO_ZSH_ZPYTHON" ; then
function set_theme_option() {
POWERLINE_THEME_CONFIG[$1]=$2
powerline-reload-config
}
function set_theme() {
typeset -A POWERLINE_CONFIG
POWERLINE_CONFIG=(
ext.shell.theme $1
)
powerline-reload-config
}
else
function set_theme_option() {
POWERLINE_COMMAND="$POWERLINE_COMMAND -t $1=$2"
}
function set_theme() {
POWERLINE_COMMAND="$POWERLINE_COMMAND -c ext.shell.theme=$1"
}
fi
source powerline/bindings/zsh/powerline.zsh
POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.segment_data.hostname.args.only_if_ssh=false"
POWERLINE_COMMAND="$POWERLINE_COMMAND -c ext.shell.theme=default_leftonly"
typeset -gA POWERLINE_CONFIG POWERLINE_THEME_CONFIG
set_theme_option default_leftonly.segment_data.hostname.args.only_if_ssh false
set_theme_option default.segment_data.hostname.args.only_if_ssh false
set_theme default_leftonly
export VIRTUAL_ENV=
cd tests/shell/3rd
cd .git
@ -28,13 +46,13 @@ cd ../'$(echo)'
cd ../'`echo`'
cd ../'«Unicode!»'
cd ..
POWERLINE_COMMAND="${POWERLINE_COMMAND//_leftonly}" ; bindkey -v
bindkey -v ; set_theme default

echo abc
false
POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.segment_data.hostname.display=false"
POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.segment_data.user.display=false"
set_theme_option default.segment_data.hostname.display false
set_theme_option default.segment_data.user.display false
select abc in def ghi jkl
do
echo $abc
@ -44,7 +62,7 @@ done
cd .
cd .
hash -d foo=$PWD:h ; cd .
POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC"
set_theme_option default.dividers.left.hard \$ABC
true
true is the last line
exit

View File

@ -70,6 +70,7 @@ run() {
TEST_CLIENT="${TEST_CLIENT}" \
SH="${SH}" \
DIR1="${DIR1}" \
POWERLINE_NO_ZSH_ZPYTHON="$(test $TEST_TYPE = zpython || echo 1)" \
DIR2="${DIR2}" \
XDG_CONFIG_HOME="$PWD/tests/shell/fish_home" \
IPYTHONDIR="$PWD/tests/shell/ipython_home" \
@ -370,6 +371,16 @@ if ! test -z "$(cat tests/shell/daemon_log_2)" ; then
FAIL_SUMMARY="${FAIL_SUMMARY}${NL}L"
fi
if ( test "x${ONLY_SHELL}" = "x" || test "x${ONLY_SHELL}" = "xzsh" ) \
&& ( test "x${ONLY_TEST_TYPE}" = "x" || test "x${ONLY_TEST_TYPE}" = "xzpython" ) \
&& zsh -f -c 'zmodload libzpython' 2>/dev/null; then
echo "> zpython"
if ! run_test zpython zpython zsh -f -i ; then
FAILED=1
FAIL_SUMMARY="${FAIL_SUMMARY}${NL}T zpython zsh -f -i"
fi
fi
if test "x${ONLY_SHELL}" = "x" || test "x${ONLY_SHELL}" = "xipython" ; then
if which ipython >/dev/null ; then
echo "> $(which ipython)"

View File

@ -18,14 +18,14 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  `echo`  cd ../'«Unicode!»'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  «Unicode!»  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  POWERLINE_COMMAND="${POWERLINE_COMMAND//_leftonly}" ; bindkey -v
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bindkey -v ; set_theme default
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd   COMMND   HOSTNAME  USER  ⋯  tests  shell  3rd  
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  echo abc
abc
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  false
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.segment_data.hostname.display=false"
 INSERT  USER  ⋯  tests  shell  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.segment_data.user.display=false"
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  set_theme_option default.segment_data.hostname.display false
 INSERT  USER  ⋯  tests  shell  3rd  set_theme_option default.segment_data.user.display false
 INSERT  ⋯  tests  shell  3rd  select abc in def ghi jkl
 select                            do
 select                             echo $abc
@ -37,5 +37,5 @@ def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC"
 INSERT  ~foo  3rd  set_theme_option default.dividers.left.hard \$ABC
 INSERT $ABC~foo  3rd $ABCtrue

View File

@ -18,14 +18,14 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  `echo`  cd ../'«Unicode!»'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  «Unicode!»  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  POWERLINE_COMMAND="${POWERLINE_COMMAND//_leftonly}" ; bindkey -v
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bindkey -v ; set_theme default
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd   COMMND   HOSTNAME  USER  ⋯  tests  shell  3rd  
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  echo abc
abc
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  false
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.segment_data.hostname.display=false"
 INSERT  USER  ⋯  tests  shell  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.segment_data.user.display=false"
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  set_theme_option default.segment_data.hostname.display false
 INSERT  USER  ⋯  tests  shell  3rd  set_theme_option default.segment_data.user.display false
 INSERT  ⋯  tests  shell  3rd  select abc in def ghi jkl
 select  do
 select   echo $abc
@ -37,5 +37,5 @@ def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC"
 INSERT  ~foo  3rd  set_theme_option default.dividers.left.hard \$ABC
 INSERT $ABC~foo  3rd $ABCtrue

View File

@ -0,0 +1,41 @@
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd .git
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="/home/USER/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
[1] PID
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill `cat pid` ; sleep 1s
[1] + terminated bgscript.sh
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd "$DIR1"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m  cd ../"$DIR2"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H  cd ../'\[\]'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  \[\]  cd ../'%%'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  %%  cd ../'#[bold]'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  `echo`  cd ../'«Unicode!»'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  «Unicode!»  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bindkey -v ; set_theme default
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd   COMMND   HOSTNAME  USER  ⋯  tests  shell  3rd  
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  echo abc
abc
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  false
 INSERT   HOSTNAME  USER  ⋯  tests  shell  3rd  set_theme_option default.segment_data.hostname.display false
 INSERT  USER  ⋯  tests  shell  3rd  set_theme_option default.segment_data.user.display false
 INSERT  ⋯  tests  shell  3rd  select abc in def ghi jkl
 select                            do
 select                             echo $abc
 select                             break
 select                            done
1) def 2) ghi 3) jkl
                   Select variant  1
def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  set_theme_option default.dividers.left.hard \$ABC
 INSERT $ABC~foo  3rd $ABCtrue