]>
diplodocus.org Git - nmh/blob - test/format/test-curses
3 # Test that the curses function escapes work
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir
=`dirname "$0"`/..
/..
10 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 .
"$MH_OBJ_DIR/test/common.sh"
16 expected
="$MH_TEST_DIR/$$.expected"
17 actual
="$MH_TEST_DIR/$$.actual"
21 # FreeBSD 9's tput(1) doesn't handle terminfo capabilities, so fall
22 # back to termcap capability codes. Its tigetstr(3X) does handle
23 # them, so the nmh curses support, including etc/scan.curses, works
25 if tput -Txterm-color sgr0
>/dev
/null
2>&1; then
30 elif tput -Txterm-color me
>/dev
/null
2>&1; then
36 test_skip
"unable to use terminfo or termcap capabilities"
39 tput -Txterm-color ${reset_code} >/dev
/null
2>&1 ||
40 test_skip
"missing terminfo entry for xterm-color"
41 tput -Tvt100 ${reset_code} > /dev
/null
2>&1 ||
42 test_skip
"missing terminfo entry for vt100"
45 # Set up things so messages 7-10 are unseen, and message 6 is cur
48 echo "Unseen-Sequence: unseen" >> "$MH"
49 mark
+inbox
7-10 -seq unseen
-add
50 mark
6 -seq cur
-add -zero
53 # Right now, in scan.curses cur is marked with standout for monochrome, red
54 # for color, and unseen is marked with with bold/green for unseen.
57 TERM
=vt100
; export TERM
59 standout
=`tput ${standout_code}`
60 bold
=`tput ${bold_code}`
61 reset=`tput ${reset_code}`
63 cat > "$expected" <<EOF
64 1 09/29 Test1 Testing message 1<<This is message number 1 >>${reset}
65 2 09/29 Test2 Testing message 2<<This is message number 2 >>${reset}
66 3 09/29 Test3 Testing message 3<<This is message number 3 >>${reset}
67 4 09/29 Test4 Testing message 4<<This is message number 4 >>${reset}
68 5 09/29 Test5 Testing message 5<<This is message number 5 >>${reset}
69 ${standout} 6+ 09/29 Test6 Testing message 6<<This is message number 6 >>${reset}
70 ${bold} 7 09/29 Test7 Testing message 7<<This is message number 7 >>${reset}
71 ${bold} 8 09/29 Test8 Testing message 8<<This is message number 8 >>${reset}
72 ${bold} 9 09/29 Test9 Testing message 9<<This is message number 9 >>${reset}
73 ${bold} 10 09/29 Test10 Testing message 10<<This is message number 10 >>${reset}
76 run_prog scan
-width 80 -form scan.curses
> "$actual"
77 check
"$expected" "$actual"
80 # xterm-color should cause %(hascolor) to return true, so we should execute
81 # all of the color-based scan output. According to the terminfo
82 # documentation the color red should be 1, where green is 2. But the
83 # format code will fall back to the older setf capability if setaf isn't
84 # supported, which has a different color numbering scheme; we should
85 # test for that at some point.
88 TERM
=xterm
-color; export TERM
90 red
=`tput ${foreground_code} 1`
91 green
=`tput ${foreground_code} 2`
92 reset=`tput ${reset_code}`
94 cat > "$expected" <<EOF
95 1 09/29 Test1 Testing message 1<<This is message number 1 >>${reset}
96 2 09/29 Test2 Testing message 2<<This is message number 2 >>${reset}
97 3 09/29 Test3 Testing message 3<<This is message number 3 >>${reset}
98 4 09/29 Test4 Testing message 4<<This is message number 4 >>${reset}
99 5 09/29 Test5 Testing message 5<<This is message number 5 >>${reset}
100 ${red} 6+ 09/29 Test6 Testing message 6<<This is message number 6 >>${reset}
101 ${green} 7 09/29 Test7 Testing message 7<<This is message number 7 >>${reset}
102 ${green} 8 09/29 Test8 Testing message 8<<This is message number 8 >>${reset}
103 ${green} 9 09/29 Test9 Testing message 9<<This is message number 9 >>${reset}
104 ${green} 10 09/29 Test10 Testing message 10<<This is message number 10 >>${reset}
107 run_prog scan
-width 80 -form scan.curses
> "$actual"
108 check
"$expected" "$actual"