3 # A very simple function test for gdiffmk.sh.
5 # Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
6 # Written by Mike Bianchi <MBianchi@Foveal.com <mailto:MBianchi@Foveal.com>>
8 # This file is part of the gdiffmk utility, which is part of groff.
10 # groff is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # groff is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 # License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # This file is part of GNU gdiffmk.
28 # Test the number of arguments and the first argument.
31 rm -fv result* tmp_file*
37 echo >&2 "$0 [ clean | run ]
38 Run a few simple tests on \`${command}'."'
40 clean Remove the result? and tmp_file? files.
60 trap 'rm -f ${tmpfile}' 0 1 2 3 15
66 ${command} ${srcdir}/file1 ${srcdir}/file2 ${ResultFile} 2>${tmpfile}
67 cat ${tmpfile} >>${ResultFile}
68 TestResult ${srcdir}/baseline ${ResultFile}
70 # OUTPUT to stdout by default
72 ${command} ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
73 TestResult ${srcdir}/baseline ${ResultFile}
75 # OUTPUT to stdout via - argument
77 ${command} ${srcdir}/file1 ${srcdir}/file2 - >${ResultFile} 2>&1
78 TestResult ${srcdir}/baseline ${ResultFile}
80 # FILE1 from standard input via - argument
82 ${command} - ${srcdir}/file2 <${srcdir}/file1 >${ResultFile} 2>&1
83 TestResult ${srcdir}/baseline ${ResultFile}
85 # FILE2 from standard input via - argument
87 ${command} ${srcdir}/file1 - <${srcdir}/file2 >${ResultFile} 2>&1
88 TestResult ${srcdir}/baseline ${ResultFile}
90 # Different values for addmark, changemark, deletemark
92 ${command} -aA -cC -dD ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
93 TestResult ${srcdir}/baseline.6 ${ResultFile}
95 # Test for accidental file overwrite.
97 cp ${srcdir}/file2 tmp_file.7
98 ${command} -aA -dD -cC ${srcdir}/file1 tmp_file.7 tmp_file.7 \
100 TestResult ${srcdir}/baseline.7 ${ResultFile}
104 ${command} -D ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
105 TestResult ${srcdir}/baseline.8 ${ResultFile}
107 # Test -D and -M options
109 ${command} -D -M '<<<<' '>>>>' \
110 ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
111 TestResult ${srcdir}/baseline.9 ${ResultFile}
113 # Test -D and -B options
115 ${command} -D -B ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
116 TestResult ${srcdir}/baseline.10 ${ResultFile}