aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-02 22:41:41 +0100
committerBoris Faure <billiob@gmail.com>2019-01-02 22:41:41 +0100
commit06abd7e9bc46e2845c8389d5ccfb23f540fb0ef2 (patch)
tree54d571b7e11ba7528dd4273b52d7328a7b8d1dfc /tests
parenttests/cursor-movements.sh: test cursor up for real (diff)
downloadterminology-06abd7e9bc46e2845c8389d5ccfb23f540fb0ef2.tar.gz
termptyesc: move ED handler to its own functions + add tests
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ed-0.sh55
-rwxr-xr-xtests/ed-1.sh55
-rwxr-xr-xtests/ed-2.sh55
-rwxr-xr-xtests/ed-3.sh55
-rwxr-xr-xtests/ed-4.sh55
-rw-r--r--tests/tests.results5
6 files changed, 280 insertions, 0 deletions
diff --git a/tests/ed-0.sh b/tests/ed-0.sh
new file mode 100755
index 0000000..cbfb7bb
--- /dev/null
+++ b/tests/ed-0.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+
+# fill space
+for V in $(seq 0 50); do
+ printf '%s\n' "$V"
+done
+
+# fill space
+PL=0
+for _ in $(seq 0 23); do
+ PL=$((PL+1))
+ if [ $PL -ge 9 ] ; then
+ PL=0
+ fi
+ for _ in $(seq 1 $PL); do
+ printf '#'
+ done
+ PR=$((10 - PL))
+ for _ in $(seq 0 6); do
+ printf '\033[0;1m\-'
+ printf '\033[0;46;1;4m/'
+ printf '\033[0;46;1;4m|'
+ printf '\033[0;1;4;7m\\'
+ printf '\033[0m~'
+ printf '\033[0;1m_'
+ printf '\033[0;31;7m>'
+ printf '\033[0;31;4;7m^'
+ printf '\033[0;1;7m<'
+ done
+ printf '\033[0m'
+ for _ in $(seq 1 $PR); do
+ printf '#'
+ done
+done
+
+
+# set color
+printf '\033[43;32;3m'
+
+# set top/bottom margins:
+printf '\033[3;20r'
+# allow left/right margins
+printf '\033[?69h'
+# set left/right margins:
+printf '\033[5;75s'
+
+# restrict cursor
+printf '\033[?6h'
+
+# move
+printf '\033[10;30H'
+
+# ED 0 (default) (Erase from the cursor to the end)
+printf '\033[J'
diff --git a/tests/ed-1.sh b/tests/ed-1.sh
new file mode 100755
index 0000000..08b9887
--- /dev/null
+++ b/tests/ed-1.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+
+# fill space
+for V in $(seq 0 50); do
+ printf '%s\n' "$V"
+done
+
+# fill space
+PL=0
+for _ in $(seq 0 23); do
+ PL=$((PL+1))
+ if [ $PL -ge 9 ] ; then
+ PL=0
+ fi
+ for _ in $(seq 1 $PL); do
+ printf '#'
+ done
+ PR=$((10 - PL))
+ for _ in $(seq 0 6); do
+ printf '\033[0;1m\-'
+ printf '\033[0;46;1;4m/'
+ printf '\033[0;46;1;4m|'
+ printf '\033[0;1;4;7m\\'
+ printf '\033[0m~'
+ printf '\033[0;1m_'
+ printf '\033[0;31;7m>'
+ printf '\033[0;31;4;7m^'
+ printf '\033[0;1;7m<'
+ done
+ printf '\033[0m'
+ for _ in $(seq 1 $PR); do
+ printf '#'
+ done
+done
+
+
+# set color
+printf '\033[43;32;3m'
+
+# set top/bottom margins:
+printf '\033[3;20r'
+# allow left/right margins
+printf '\033[?69h'
+# set left/right margins:
+printf '\033[5;75s'
+
+# restrict cursor
+printf '\033[?6h'
+
+# move
+printf '\033[10;30H'
+
+# ED 1 (Erase the beginning of the display through the cursor)
+printf '\033[1J'
diff --git a/tests/ed-2.sh b/tests/ed-2.sh
new file mode 100755
index 0000000..a3bfac0
--- /dev/null
+++ b/tests/ed-2.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+
+# fill space
+for V in $(seq 0 50); do
+ printf '%s\n' "$V"
+done
+
+# fill space
+PL=0
+for _ in $(seq 0 23); do
+ PL=$((PL+1))
+ if [ $PL -ge 9 ] ; then
+ PL=0
+ fi
+ for _ in $(seq 1 $PL); do
+ printf '#'
+ done
+ PR=$((10 - PL))
+ for _ in $(seq 0 6); do
+ printf '\033[0;1m\-'
+ printf '\033[0;46;1;4m/'
+ printf '\033[0;46;1;4m|'
+ printf '\033[0;1;4;7m\\'
+ printf '\033[0m~'
+ printf '\033[0;1m_'
+ printf '\033[0;31;7m>'
+ printf '\033[0;31;4;7m^'
+ printf '\033[0;1;7m<'
+ done
+ printf '\033[0m'
+ for _ in $(seq 1 $PR); do
+ printf '#'
+ done
+done
+
+
+# set color
+printf '\033[43;32;3m'
+
+# set top/bottom margins:
+printf '\033[3;20r'
+# allow left/right margins
+printf '\033[?69h'
+# set left/right margins:
+printf '\033[5;75s'
+
+# restrict cursor
+printf '\033[?6h'
+
+# move
+printf '\033[10;30H'
+
+# ED 2 (The complete display)
+printf '\033[2J'
diff --git a/tests/ed-3.sh b/tests/ed-3.sh
new file mode 100755
index 0000000..4a88620
--- /dev/null
+++ b/tests/ed-3.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+
+# fill space
+for V in $(seq 0 50); do
+ printf '%s\n' "$V"
+done
+
+# fill space
+PL=0
+for _ in $(seq 0 23); do
+ PL=$((PL+1))
+ if [ $PL -ge 9 ] ; then
+ PL=0
+ fi
+ for _ in $(seq 1 $PL); do
+ printf '#'
+ done
+ PR=$((10 - PL))
+ for _ in $(seq 0 6); do
+ printf '\033[0;1m\-'
+ printf '\033[0;46;1;4m/'
+ printf '\033[0;46;1;4m|'
+ printf '\033[0;1;4;7m\\'
+ printf '\033[0m~'
+ printf '\033[0;1m_'
+ printf '\033[0;31;7m>'
+ printf '\033[0;31;4;7m^'
+ printf '\033[0;1;7m<'
+ done
+ printf '\033[0m'
+ for _ in $(seq 1 $PR); do
+ printf '#'
+ done
+done
+
+
+# set color
+printf '\033[43;32;3m'
+
+# set top/bottom margins:
+printf '\033[3;20r'
+# allow left/right margins
+printf '\033[?69h'
+# set left/right margins:
+printf '\033[5;75s'
+
+# restrict cursor
+printf '\033[?6h'
+
+# move
+printf '\033[10;30H'
+
+# ED 3 (The display scrollback)
+printf '\033[3J'
diff --git a/tests/ed-4.sh b/tests/ed-4.sh
new file mode 100755
index 0000000..0936693
--- /dev/null
+++ b/tests/ed-4.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+
+# fill space
+for V in $(seq 0 50); do
+ printf '%s\n' "$V"
+done
+
+# fill space
+PL=0
+for _ in $(seq 0 23); do
+ PL=$((PL+1))
+ if [ $PL -ge 9 ] ; then
+ PL=0
+ fi
+ for _ in $(seq 1 $PL); do
+ printf '#'
+ done
+ PR=$((10 - PL))
+ for _ in $(seq 0 6); do
+ printf '\033[0;1m\-'
+ printf '\033[0;46;1;4m/'
+ printf '\033[0;46;1;4m|'
+ printf '\033[0;1;4;7m\\'
+ printf '\033[0m~'
+ printf '\033[0;1m_'
+ printf '\033[0;31;7m>'
+ printf '\033[0;31;4;7m^'
+ printf '\033[0;1;7m<'
+ done
+ printf '\033[0m'
+ for _ in $(seq 1 $PR); do
+ printf '#'
+ done
+done
+
+
+# set color
+printf '\033[43;32;3m'
+
+# set top/bottom margins:
+printf '\033[3;20r'
+# allow left/right margins
+printf '\033[?69h'
+# set left/right margins:
+printf '\033[5;75s'
+
+# restrict cursor
+printf '\033[?6h'
+
+# move
+printf '\033[10;30H'
+
+# ED 4 nothing
+printf '\033[4J'
diff --git a/tests/tests.results b/tests/tests.results
index 5ca47af..e104152 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -52,3 +52,8 @@ decrara-no-rectangular-restrict-cursor.sh 815a848844cf7ea33d60e71948346a33
decic-decdc.sh 6d67999a7c5c771281ff2229cdbdda76
ich.sh 3bd7dfc4a7cbcdf0985cda5da46e07ec
deccra.sh 6a0846004c4effb9d5eb45b8044d5f7e
+ed-0.sh 169d09249a920f95e5c9fc517d5f90a9
+ed-1.sh 399897d5dd697adea2cc460ca6132826
+ed-2.sh 82e7919a46fdea3a003143b41562b148
+ed-3.sh 005871b7e4d63017c08a73ab34f99b14
+ed-4.sh 574f37ac24ead26ef86c03d7dfae3152