aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/common.sh4
-rwxr-xr-xt/interactive-redraw33
2 files changed, 37 insertions, 0 deletions
diff --git a/t/common.sh b/t/common.sh
index 38d2845..bb1bd83 100644
--- a/t/common.sh
+++ b/t/common.sh
@@ -144,6 +144,10 @@ interactive_prompt () {
printf '\e[1;34m(%s/%s) Resolve this conflict [h,t,b,m,y,r,e,s,d,q,?]? \e[0m\n' "$1" "$2"
}
+interactive_clear_screen () {
+ printf '\e[H\e[2J'
+}
+
interactive_help () {
test $# = 1
printf '\e[1;31m'
diff --git a/t/interactive-redraw b/t/interactive-redraw
new file mode 100755
index 0000000..71fdca6
--- /dev/null
+++ b/t/interactive-redraw
@@ -0,0 +1,33 @@
+#!/bin/sh -e
+. t/common.sh
+interactive
+
+printf '%s\n' > file \
+ "${HEAD} ours" \
+ head \
+ "${TAIL}" \
+ tail \
+ "${END} theirs"
+
+printf '%s\n' > file.expected \
+ head
+
+(
+ interactive_marker "${HEAD} ours"
+ interactive_side head
+ interactive_marker "${TAIL}"
+ interactive_side tail
+ interactive_marker "${END} theirs"
+ interactive_prompt 1 1
+ interactive_clear_screen
+ interactive_marker "${HEAD} ours"
+ interactive_side head
+ interactive_marker "${TAIL}"
+ interactive_side tail
+ interactive_marker "${END} theirs"
+ interactive_prompt 1 1
+) > output.expected
+
+printf '\fh' > input
+normal --interactive file 8<input 9>output
+diff -u -- output.expected output >&2