Add cursor regression tests.

This commit is contained in:
Nicholas Marriott 2019-04-02 09:36:20 +01:00
parent 294accea1b
commit 79c3fd4f39
9 changed files with 212 additions and 0 deletions

6
regress/cursor-test.txt Normal file
View File

@ -0,0 +1,6 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.

View File

@ -0,0 +1,33 @@
14 8 t
0 ud exercitation ullamco laboris nisi ut
1 aliquip ex ea
2 commodo consequat. Duis aute
3 irure dolor in reprehenderit in voluptat
4 e velit esse cillum dolore eu fugiat
5 nulla pariatur. Excepteur sint occaecat
6 cupidatat non proident, sunt in culpa qu
7 i officia
8 deserunt mollit anim id est laborum.
9
4 6 t
0 cupidatat
1 non proide
2 nt, sunt i
3 n culpa qu
4 i officia
5 deserunt m
6 ollit anim
7 id est la
8 borum.
9
14 8 t
0 incididunt ut labore et dolore magna aliqua. Ut en
1 im ad minim veniam, quis nostrud exercitation ulla
2 mco laboris nisi ut aliquip ex ea
3 commodo consequat. Duis aute
4 irure dolor in reprehenderit in voluptate velit es
5 se cillum dolore eu fugiat
6 nulla pariatur. Excepteur sint occaecat cupidatat
7 non proident, sunt in culpa qui officia
8 deserunt mollit anim id est laborum.
9

28
regress/cursor-test1.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/sh
PATH=/bin:/usr/bin
TERM=screen
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest"
$TMUX kill-server 2>/dev/null
TMP=$(mktemp)
trap "rm -f $TMP" 0 1 15
$TMUX new -d -x40 -y10 "cat cursor-test.txt; printf '\e[9;15H'; cat" || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x10 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x50 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
cmp -s $TMP cursor-test1.result || exit 1
$TMUX kill-server 2>/dev/null
exit 0

View File

@ -0,0 +1,33 @@
9 7 a
0 cupidatat
1 non proide
2 nt, sunt i
3 n culpa qu
4 i officia
5 deserunt m
6 ollit anim
7 id est la
8 borum.
9
4 6 a
0 icia
1 deser
2 unt m
3 ollit
4 anim
5 id e
6 st la
7 borum
8 .
9
29 8 a
0 incididunt ut labore et dolore magna aliqua. Ut en
1 im ad minim veniam, quis nostrud exercitation ulla
2 mco laboris nisi ut aliquip ex ea
3 commodo consequat. Duis aute
4 irure dolor in reprehenderit in voluptate velit es
5 se cillum dolore eu fugiat
6 nulla pariatur. Excepteur sint occaecat cupidatat
7 non proident, sunt in culpa qui officia
8 deserunt mollit anim id est laborum.
9

28
regress/cursor-test2.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/sh
PATH=/bin:/usr/bin
TERM=screen
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest"
$TMUX kill-server 2>/dev/null
TMP=$(mktemp)
trap "rm -f $TMP" 0 1 15
$TMUX new -d -x10 -y10 "cat cursor-test.txt; printf '\e[8;10H'; cat" || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x5 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x50 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
cmp -s $TMP cursor-test2.result || exit 1
$TMUX kill-server 2>/dev/null
exit 0

View File

@ -0,0 +1,9 @@
6 1 b
0 abcdefa
1 bcdefab
3 1 b
0 fabcd
1 efab
6 1 b
0 abcdefa
1 bcdefab

28
regress/cursor-test3.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/sh
PATH=/bin:/usr/bin
TERM=screen
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest"
$TMUX kill-server 2>/dev/null
TMP=$(mktemp)
trap "rm -f $TMP" 0 1 15
$TMUX new -d -x7 -y2 "printf 'abcdefabcdefab'; printf '\e[2;7H'; cat" || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x5 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x7 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
cmp -s $TMP cursor-test3.result || exit 1
$TMUX kill-server 2>/dev/null
exit 0

View File

@ -0,0 +1,16 @@
0 1
0 abcdef
1
2
0 1
0 abcdef
1
2
0 1
0 def
1
2
0 1
0 abcdef
1
2

31
regress/cursor-test4.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
PATH=/bin:/usr/bin
TERM=screen
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest"
$TMUX kill-server 2>/dev/null
TMP=$(mktemp)
trap "rm -f $TMP" 0 1 15
$TMUX new -d -x10 -y3 "printf 'abcdef\n'; cat" || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x20 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x3 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
$TMUX resizew -x10 || exit 1
$TMUX display -pF '#{cursor_x} #{cursor_y} #{cursor_character}' >>$TMP
$TMUX capturep -p|awk '{print NR-1,$0}' >>$TMP
cmp -s $TMP cursor-test4.result || exit 1
$TMUX kill-server 2>/dev/null
exit 0