Remove “test x” nonsense

This commit is contained in:
Foo 2017-05-01 01:28:44 +03:00
parent 2fcbd89ef8
commit 4c5b02d236
9 changed files with 36 additions and 42 deletions

View File

@ -111,7 +111,7 @@ following in ``~/.profile``:
.. code-block:: bash
if test "x$0" != "x${0#dash}" ; then
if test "$0" != "${0#dash}" ; then
export ENV={repository_root}/powerline/bindings/shell/powerline.sh
fi

View File

@ -21,7 +21,7 @@ _powerline_tmux_setenv() {
}
_powerline_tmux_set_pwd() {
if test "x$_POWERLINE_SAVED_PWD" != "x$PWD" ; then
if test "$_POWERLINE_SAVED_PWD" != "$PWD" ; then
_POWERLINE_SAVED_PWD="$PWD"
_powerline_tmux_setenv PWD "$PWD"
fi
@ -39,8 +39,8 @@ _powerline_init_tmux_support() {
trap '_powerline_tmux_set_columns' WINCH
_powerline_tmux_set_columns
test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND/_powerline_tmux_set_pwd}" ||
PROMPT_COMMAND="${PROMPT_COMMAND}"$'\n_powerline_tmux_set_pwd'
test "$PROMPT_COMMAND" != "${PROMPT_COMMAND/_powerline_tmux_set_pwd}" \
|| PROMPT_COMMAND="${PROMPT_COMMAND}"$'\n_powerline_tmux_set_pwd'
fi
}
@ -82,8 +82,8 @@ _powerline_setup_prompt() {
if test -z "${POWERLINE_COMMAND}" ; then
POWERLINE_COMMAND="$("$POWERLINE_CONFIG_COMMAND" shell command)"
fi
test "x$PROMPT_COMMAND" != "x${PROMPT_COMMAND%_powerline_set_prompt*}" ||
PROMPT_COMMAND=$'_powerline_set_prompt\n'"${PROMPT_COMMAND}"
test "$PROMPT_COMMAND" != "${PROMPT_COMMAND%_powerline_set_prompt*}" \
|| PROMPT_COMMAND=$'_powerline_set_prompt\n'"${PROMPT_COMMAND}"
PS2="$(_powerline_local_prompt left -r.bash 0 0 continuation)"
PS3="$(_powerline_local_prompt left '' 0 0 select)"
}

View File

@ -34,7 +34,7 @@ function powerline-setup
set -g POWERLINE_COMMAND (env $POWERLINE_CONFIG_COMMAND shell command)
end
function _powerline_set_default_mode --on-variable fish_key_bindings
if test x$fish_key_bindings != xfish_vi_key_bindings
if test $fish_key_bindings != fish_vi_key_bindings
set -g _POWERLINE_DEFAULT_MODE default
else
set -g -e _POWERLINE_DEFAULT_MODE

View File

@ -37,7 +37,7 @@ fn _powerline_common_setup {
}
fn _powerline_tmux_pane {
if (test x$TMUX_PANE '!=' x) {
if (test -n $TMUX_PANE) {
echo $TMUX_PANE | tr -d ' %'
} else {
TMUX=$_POWERLINE_TMUX tmux display -p '#D' | tr -d ' %'
@ -54,9 +54,9 @@ if (test -z $POWERLINE_CONFIG_COMMAND) {
echo powerline-config executable not found, unable to proceed >[2=1]
}
}
if (test x$POWERLINE_CONFIG_COMMAND '!=' x) {
if (test -n $POWERLINE_CONFIG_COMMAND) {
if ($POWERLINE_CONFIG_COMMAND shell --shell rcsh uses prompt) {
if (test x$POWERLINE_COMMAND_ARGS '!=' x) {
if (test -n $POWERLINE_COMMAND_ARGS) {
# Perform splitting
POWERLINE_COMMAND_ARGS=( `{echo $POWERLINE_COMMAND_ARGS} )
}
@ -75,11 +75,11 @@ if (test x$POWERLINE_CONFIG_COMMAND '!=' x) {
}
_powerline_common_setup
}
if (test x$TMUX '!=' x) {
if (test -n $TMUX) {
if ($POWERLINE_CONFIG_COMMAND shell --shell rcsh uses tmux) {
_POWERLINE_TMUX=$TMUX
fn _powerline_tmux_setenv {
if (test x$2 '!=' x) {
if (test -n $2) {
TMUX=$_POWERLINE_TMUX tmux setenv -g TMUX_$1^_`{
_powerline_tmux_pane
} $2

View File

@ -115,7 +115,7 @@ _powerline_tmux_setenv() {
}
_powerline_tmux_set_pwd() {
if test "x$_POWERLINE_SAVED_PWD" != "x$PWD" ; then
if test "$_POWERLINE_SAVED_PWD" != "$PWD" ; then
_POWERLINE_SAVED_PWD="$PWD"
_powerline_tmux_setenv PWD "$PWD"
fi

View File

@ -30,14 +30,14 @@ exit_suite() {
echo "${FAIL_SUMMARY}"
fi
export POWERLINE_CURRENT_SUITE="${POWERLINE_CURRENT_SUITE%/*}"
if test "x$1" != "x--continue" ; then
if test "$1" != "--continue" ; then
exit $FAILED
fi
}
fail() {
local allow_failure=
if test "x$1" = "x--allow-failure" ; then
if test "$1" = "--allow-failure" ; then
shift
allow_failure=A
fi
@ -48,7 +48,7 @@ fail() {
FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}"
echo "Failed: $full_msg"
echo "$full_msg" >> "$FAILURES_FILE"
if test "x$allow_failure" = "x" ; then
if test -z "$allow_failure" ; then
FAILED=1
fi
}

View File

@ -30,7 +30,7 @@ for pexe in powerline powerline.sh powerline.py ; do
else
continue
fi
if test "x$pexe" != 'xpowerline.sh' || test -e "$TEST_PATH/socat" ; then
if test "$pexe" != 'powerline.sh' || test -e "$TEST_PATH/socat" ; then
POWERLINE_COMMAND="$pexe"
break
fi
@ -74,7 +74,7 @@ check_log() {
return 1
fi
local expline="powerline_widget:set_markup('<span foreground=\"#303030\"> </span><span foreground=\"#d0d0d0\" background=\"#303030\" font_weight=\"bold\"> default-right </span>')"
if test "x$expline" != "x$line" ; then
if test "$expline" != "$line" ; then
echo "Line: '$line'"
echo "Expected: '$expline'"
fail "log:line" F "Unexpected line"
@ -119,7 +119,7 @@ else
sleep 5
killscript "$(cat "$TEST_ROOT/$args-pid")"
rm "$TEST_ROOT/$args-pid"
if test "x$(cat "$DEPRECATED_LOG")" != "x" ; then
if test -n "$(cat "$DEPRECATED_LOG")" ; then
display_log "$DEPRECATED_LOG"
fail "output" E "Nonempty $DEPRECATED_SCRIPT output"
fi
@ -153,7 +153,7 @@ run "$POWERLINE_COMMAND" --socket $ADDRESS wm.awesome > "$TEST_ROOT/output.log.3
run "$POWERLINE_COMMAND" --socket $ADDRESS wm.awesome > "$TEST_ROOT/output.log.4" 2>&1
run "$POWERLINE_COMMAND" --socket $ADDRESS wm.awesome > "$TEST_ROOT/output.log.5" 2>&1
for log_file in "$TEST_ROOT"/output.log.* ; do
if test "x$(cat "$log_file")" != "x" ; then
if test -n "$(cat "$log_file")" ; then
display_log "$log_file"
fail "output" E "Nonempty $POWERLINE_COMMAND output at run ${log_file#*.}"
fi
@ -161,13 +161,13 @@ for log_file in "$TEST_ROOT"/output.log.* ; do
done
sleep 5
run python "$POWERLINE_DAEMON" --socket $ADDRESS --quiet --kill > "$TEST_ROOT/kill.log" 2>&1
if test "x$(cat "$TEST_ROOT/kill.log")" != "x" ; then
if test -n "$(cat "$TEST_ROOT/kill.log")" ; then
display_log "$TEST_ROOT/kill.log"
fail "daemonlog" E "Nonempty kill log"
fi
rm "$TEST_ROOT/kill.log"
wait $DPID
if test "x$(cat "$TEST_ROOT/daemon.log")" != "x" ; then
if test -n "$(cat "$TEST_ROOT/daemon.log")" ; then
display_log "$TEST_ROOT/daemon.log"
fail "daemonlog" E "Nonempty daemon log"
fi

View File

@ -49,7 +49,7 @@ check_log() {
if test "$warns" = "warns" ; then
local warning="$(head -n1 "$log_file" | sed 's/.*://')"
local expwarning="The 'bar' bindings are deprecated, please switch to 'lemonbar'"
if test "x$warning" != "x$expwarning" ; then
if test "$warning" != "$expwarning" ; then
echo "Got: $warning"
echo "Exp: $expwarning"
fail "warn" F "Expected warning"
@ -66,7 +66,7 @@ check_log() {
return 1
fi
local expline="%{l}%{F#ffd0d0d0}%{B#ff303030} $text-left %{F-B--u}%{F#ff303030} %{F-B--u}%{r}%{F#ff303030} %{F-B--u}%{F#ffd0d0d0}%{B#ff303030} $text-right %{F-B--u}"
if test "x$expline" != "x$line" ; then
if test "$expline" != "$line" ; then
echo "Line: '$line'"
echo "Expected: '$expline'"
fail "log:line" F "Unexpected line"
@ -149,14 +149,14 @@ else
if test "$fnum" -ne 2 ; then
fail "fnum" F "Expected two output files"
fi
if test "x${args#--height}" != "x$args" ; then
if test "${args#--height}" != "$args" ; then
height="${args#--height}"
height="${height# }"
height="${height#=}"
height="${height%% *}"
fi
command="lemonbar"
if test "x${args#--bar-command}" != "x$args" ; then
if test "${args#--bar-command}" != "$args" ; then
command="${args#--bar-command}"
command="${command# }"
command="${command#=}"
@ -166,11 +166,11 @@ else
rm "$TEST_ROOT/args.log"
script_args="${args#*-- }"
script_args="${script_args# }"
if test "x${script_args}" '=' "x$args" ; then
if test "${script_args}" = "$args" ; then
script_args=
fi
expected_args="$command -g 1920x$height+0${script_args:+ }$script_args${NL}$command -g 1920x$height+1${script_args:+ }$script_args"
if test "x$expected_args" != "x$received_args" ; then
if test "$expected_args" != "$received_args" ; then
echo "args:${NL}<$received_args>"
echo "expected:${NL}<$expected_args>"
fail "args" F "Expected different args"

View File

@ -12,7 +12,7 @@ ONLY_TEST_CLIENT="$3"
export PYTHON
if test "x$ONLY_SHELL" = "x--help" ; then
if test "$ONLY_SHELL" = "--help" ; then
cat << EOF
Usage:
$0 [[[ONLY_SHELL | ""] (ONLY_TEST_TYPE | "")] (ONLY_TEST_CLIENT | "")]
@ -53,7 +53,7 @@ print_full_output() {
cat "$TEST_ROOT/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log"
echo
echo '____________________________________________________________'
if test "x$POWERLINE_TEST_NO_CAT_V" != "x1" ; then
if test "$POWERLINE_TEST_NO_CAT_V" != "1" ; then
echo "Full output (cat -v):"
echo '============================================================'
cat -v "$TEST_ROOT/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log"
@ -71,9 +71,9 @@ do_run_test() {
local wait_for_echo_arg=
if ( \
test "x${SH}" = "xdash" \
test "${SH}" = "dash" \
|| ( \
test "x${SH}" = "xpdb" \
test "${SH}" = "pdb" \
&& ( \
( \
test "$PYTHON_VERSION_MAJOR" -eq 3 \
@ -84,7 +84,7 @@ do_run_test() {
) \
) \
|| ( \
test "x${SH}" = "xipython" \
test "${SH}" = "ipython" \
&& test "$("${PYTHON}" -mIPython --version | head -n1 | cut -d. -f1)" -ge 5 \
) \
) ; then
@ -95,7 +95,7 @@ do_run_test() {
"$@"
if ! check_screen_log ${TEST_TYPE} ${TEST_CLIENT} ${SH} ; then
echo '____________________________________________________________'
if test "x$POWERLINE_TEST_NO_CAT_V" != "x1" ; then
if test "$POWERLINE_TEST_NO_CAT_V" != "1" ; then
# Repeat the diff to make it better viewable in travis output
echo "Diff (cat -v):"
echo '============================================================'
@ -388,7 +388,7 @@ if ( \
fi
fi
SH="${TEST_COMMAND%% *}"
if test "$ONLY_SHELL" != "" && test "x$ONLY_SHELL" != "x$SH" ; then
if test -n "$ONLY_SHELL" && test "$ONLY_SHELL" != "$SH" ; then
continue
fi
if ! test -x "$TEST_ROOT/path/$SH" ; then
@ -396,13 +396,7 @@ if ( \
fi
echo ">>> $(readlink "$TEST_ROOT/path/$SH")"
if ! run_test $TEST_TYPE $TEST_CLIENT $TEST_COMMAND ; then
ALLOW_FAILURE_ARG=
# dash tests are not stable, see #931
# also do not allow fish tests to spoil the build
if test x$FAST$SH = x1dash || test x$FAST$SH = x1fish ; then
ALLOW_FAILURE_ARG="--allow-failure"
fi
fail $ALLOW_FAILURE_ARG "$SH-$TEST_TYPE-$TEST_CLIENT:test" F \
fail "$SH-$TEST_TYPE-$TEST_CLIENT:test" F \
"Failed checking $TEST_COMMAND"
fi
done