2 # A very simple function test for gdiffmk.sh.
6 # Test the number of arguments and the first argument.
9 rm -fv test_result? tmp_file?
15 echo >&2 "$0 [ clean | run ]
16 Run a few simple tests on \`${command}'."'
18 clean Remove the test_result? and tmp_file? files.
30 echo $2 TEST FAILED
'\a'
35 trap 'rm -f ${tmpfile}' 0 1 2 3 15
38 ResultFile
=test_result1
39 sh
${command} file1 file2 ${ResultFile} 2>${tmpfile}
40 cat ${tmpfile} >>${ResultFile}
41 TestResult test_baseline
${ResultFile}
43 # OUTPUT to stdout by default
44 ResultFile
=test_result2
45 sh
${command} file1 file2
>${ResultFile} 2>&1
46 TestResult test_baseline
${ResultFile}
48 # OUTPUT to stdout via - argument
49 ResultFile
=test_result3
50 sh
${command} file1 file2
- >${ResultFile} 2>&1
51 TestResult test_baseline
${ResultFile}
53 # FILE1 from standard input via - argument
54 ResultFile
=test_result4
55 sh
${command} - file2
<file1
>${ResultFile} 2>&1
56 TestResult test_baseline
${ResultFile}
58 # FILE2 from standard input via - argument
59 ResultFile
=test_result5
60 sh
${command} file1
- <file2
>${ResultFile} 2>&1
61 TestResult test_baseline
${ResultFile}
63 # Different values for addmark, changemark, deletemark
64 ResultFile
=test_result6
65 sh
${command} -aA -cC -dD file1 file2
>${ResultFile} 2>&1
66 TestResult test_baseline6
${ResultFile}
68 # Test for accidental file overwrite.
69 ResultFile
=test_result7
71 sh
${command} -aA -dD -cC file1 tmp_file7 tmp_file7
>${ResultFile} 2>&1
72 TestResult test_baseline7
${ResultFile}