Update regression tests.

This commit is contained in:
Nicholas Marriott 2024-10-05 07:01:16 +01:00
parent 42959db0a4
commit 549c35b061
5 changed files with 48 additions and 45 deletions

View File

@ -22,8 +22,8 @@ $TMUX -f/dev/null new -d "
sleep 1
(
printf '\033[1m\033[31m\033[42mabc\033[0m\033[31m\033[49mdef\n'
printf '\033[39m\033[100m bright bg\n'
printf '\033[1m\033[31m\033[42mabc\033[0m\033[31mdef\033[39m\n'
printf '\033[100m bright bg \033[49m\n'
) | cmp - $TMP || exit 1
$TMUX has 2>/dev/null && exit 1

View File

@ -172,7 +172,7 @@ test_format "#{l:#{pane_in_mode}}" "#{pane_in_mode}"
test_format "#{l:#{?pane_in_mode,#{?#{==:#{session_name},Summer},ABC,XYZ},xyz}}" "#{?pane_in_mode,#{?#{==:#{session_name},Summer},ABC,XYZ},xyz}"
# With escapes (which escape but are returned literally)
test_format "#{l:##{}" "##{"
test_format "#{l:##{}" "#{"
test_format "#{l:#{#}}}" "#{#}}"
# Invalid formats:

View File

@ -6,10 +6,10 @@ TERM=screen
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest"
$TMUX kill-server 2>/dev/null
sleep 1
$TMUX -f/dev/null new -x20 -y2 -d || exit 1
sleep 0.1
sleep 1
$TMUX set -g escape-time 0
exit_status=0
@ -17,11 +17,14 @@ assert_key () {
key=$1
expected_code=$2
$TMUX new-window -- sh -c 'stty raw -echo && cat -tv'
$TMUX send-keys "$key" $
W=$($TMUX new-window -P -- sh -c 'stty raw -echo && cat -tv')
$TMUX send-keys -t$W "$key" 'EOL' || exit 1
sleep 0.2
actual_code=$($TMUX capturep -p | head -1 | sed -e 's/\$$//')
$TMUX kill-window
actual_code=$($TMUX capturep -pt$W | \
head -1 | \
sed -e 's/EOL.*$//')
$TMUX kill-window -t$W || exit 1
if [ "$actual_code" = "$expected_code" ]; then
if [ -n "$VERBOSE" ]; then
@ -205,7 +208,7 @@ assert_key 'PageUp' '^[[5~'
assert_key 'PgUp' '^[[5~'
assert_key 'BTab' '^[[Z'
assert_key 'C-S-Tab' '^[[Z'
assert_key 'C-S-Tab' '^I'
assert_key 'Up' '^[[A'
assert_key 'Down' '^[[B'
@ -291,8 +294,8 @@ assert_extended_key 'Insert' '^[[2;_~'
assert_extended_key 'DC' '^[[3;_~'
assert_extended_key 'Delete' '^[[3;_~'
assert_key 'C-Tab' "^[[9;5u"
assert_key 'C-S-Tab' "^[[1;5Z"
assert_key 'C-Tab' "^[[27;5;9~"
assert_key 'C-S-Tab' "^[[27;6;9~"
$TMUX kill-server 2>/dev/null

View File

@ -14,7 +14,7 @@ trap "rm -f $TMP" 0 1 15
$TMUX2 -f/dev/null new -d || exit 1
$TMUX -f/dev/null new -d "$TMUX2 attach" || exit 1
sleep 0.1
sleep 1
exit_status=0
@ -60,38 +60,38 @@ assert_key () {
}
assert_key 0x00 'C-Space' # -- 'Escape 0x00' 'M-C-Space'
assert_key 0x01 'C-a' -- 'Escape 0x01' 'M-C-a'
assert_key 0x02 'C-b' -- 'Escape 0x02' 'M-C-b'
assert_key 0x03 'C-c' -- 'Escape 0x03' 'M-C-c'
assert_key 0x04 'C-d' -- 'Escape 0x04' 'M-C-d'
assert_key 0x05 'C-e' -- 'Escape 0x05' 'M-C-e'
assert_key 0x06 'C-f' -- 'Escape 0x06' 'M-C-f'
assert_key 0x07 'C-g' -- 'Escape 0x07' 'M-C-g'
assert_key 0x08 'C-h' -- 'Escape 0x08' 'M-C-h'
assert_key 0x00 'C-Space' # -- 'Escape 0x00' 'C-M-Space'
assert_key 0x01 'C-a' -- 'Escape 0x01' 'C-M-a'
assert_key 0x02 'C-b' -- 'Escape 0x02' 'C-M-b'
assert_key 0x03 'C-c' -- 'Escape 0x03' 'C-M-c'
assert_key 0x04 'C-d' -- 'Escape 0x04' 'C-M-d'
assert_key 0x05 'C-e' -- 'Escape 0x05' 'C-M-e'
assert_key 0x06 'C-f' -- 'Escape 0x06' 'C-M-f'
assert_key 0x07 'C-g' -- 'Escape 0x07' 'C-M-g'
assert_key 0x08 'C-h' -- 'Escape 0x08' 'C-M-h'
assert_key 0x09 'Tab' -- 'Escape 0x09' 'M-Tab'
assert_key 0x0A 'C-j' -- 'Escape 0x0A' 'M-C-j'
assert_key 0x0B 'C-k' -- 'Escape 0x0B' 'M-C-k'
assert_key 0x0C 'C-l' -- 'Escape 0x0C' 'M-C-l'
assert_key 0x0A 'C-j' -- 'Escape 0x0A' 'C-M-j'
assert_key 0x0B 'C-k' -- 'Escape 0x0B' 'C-M-k'
assert_key 0x0C 'C-l' -- 'Escape 0x0C' 'C-M-l'
assert_key 0x0D 'Enter' -- 'Escape 0x0D' 'M-Enter'
assert_key 0x0E 'C-n' -- 'Escape 0x0E' 'M-C-n'
assert_key 0x0F 'C-o' -- 'Escape 0x0F' 'M-C-o'
assert_key 0x10 'C-p' -- 'Escape 0x10' 'M-C-p'
assert_key 0x11 'C-q' -- 'Escape 0x11' 'M-C-q'
assert_key 0x12 'C-r' -- 'Escape 0x12' 'M-C-r'
assert_key 0x13 'C-s' -- 'Escape 0x13' 'M-C-s'
assert_key 0x14 'C-t' -- 'Escape 0x14' 'M-C-t'
assert_key 0x15 'C-u' -- 'Escape 0x15' 'M-C-u'
assert_key 0x16 'C-v' -- 'Escape 0x16' 'M-C-v'
assert_key 0x17 'C-w' -- 'Escape 0x17' 'M-C-w'
assert_key 0x18 'C-x' -- 'Escape 0x18' 'M-C-x'
assert_key 0x19 'C-y' -- 'Escape 0x19' 'M-C-y'
assert_key 0x1A 'C-z' -- 'Escape 0x1A' 'M-C-z'
assert_key 0x0E 'C-n' -- 'Escape 0x0E' 'C-M-n'
assert_key 0x0F 'C-o' -- 'Escape 0x0F' 'C-M-o'
assert_key 0x10 'C-p' -- 'Escape 0x10' 'C-M-p'
assert_key 0x11 'C-q' -- 'Escape 0x11' 'C-M-q'
assert_key 0x12 'C-r' -- 'Escape 0x12' 'C-M-r'
assert_key 0x13 'C-s' -- 'Escape 0x13' 'C-M-s'
assert_key 0x14 'C-t' -- 'Escape 0x14' 'C-M-t'
assert_key 0x15 'C-u' -- 'Escape 0x15' 'C-M-u'
assert_key 0x16 'C-v' -- 'Escape 0x16' 'C-M-v'
assert_key 0x17 'C-w' -- 'Escape 0x17' 'C-M-w'
assert_key 0x18 'C-x' -- 'Escape 0x18' 'C-M-x'
assert_key 0x19 'C-y' -- 'Escape 0x19' 'C-M-y'
assert_key 0x1A 'C-z' -- 'Escape 0x1A' 'C-M-z'
assert_key 0x1B 'Escape' -- 'Escape 0x1B' 'M-Escape'
assert_key 0x1C "C-\\" -- 'Escape 0x1C' "M-C-\\"
assert_key 0x1D 'C-]' -- 'Escape 0x1D' 'M-C-]'
assert_key 0x1E 'C-^' -- 'Escape 0x1E' 'M-C-^'
assert_key 0x1F 'C-_' -- 'Escape 0x1F' 'M-C-_'
assert_key 0x1C "C-\\" -- 'Escape 0x1C' "C-M-\\"
assert_key 0x1D 'C-]' -- 'Escape 0x1D' 'C-M-]'
assert_key 0x1E 'C-^' -- 'Escape 0x1E' 'C-M-^'
assert_key 0x1F 'C-_' -- 'Escape 0x1F' 'C-M-_'
assert_key 0x20 'Space' -- 'Escape 0x20' 'M-Space'
assert_key 0x21 '!' -- 'Escape 0x21' 'M-!'
assert_key 0x22 '"' -- 'Escape 0x22' 'M-"'
@ -304,7 +304,7 @@ assert_extended_key () {
key_name=$2
assert_key "Escape [${code};5u" "C-$key_name"
assert_key "Escape [${code};7u" "M-C-$key_name"
assert_key "Escape [${code};7u" "C-M-$key_name"
}
# Extended keys