Current Path : /usr/src/contrib/groff/contrib/gdiffmk/tests/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/src/contrib/groff/contrib/gdiffmk/tests/runtests.in |
#! /bin/sh # A very simple function test for gdiffmk.sh. srcdir=@srcdir@ command=../gdiffmk # Test the number of arguments and the first argument. case $#-$1 in 1-clean ) rm -fv test_result* tmp_file* exit 0 ;; 1-run ) ;; * ) echo >&2 "$0 [ clean | run ] Run a few simple tests on \`${command}'."' clean Remove the test_result? and tmp_file? files. run Run the tests. ' exit 255 ;; esac function TestResult { if cmp -s $1 $2 then echo $2 PASSED else echo '' echo $2 TEST FAILED diff $1 $2 echo '' fi } tmpfile=/tmp/$$ trap 'rm -f ${tmpfile}' 0 1 2 3 15 # Run tests. # 3 file arguments ResultFile=test_result1 ${command} ${srcdir}/file1 ${srcdir}/file2 ${ResultFile} 2>${tmpfile} cat ${tmpfile} >>${ResultFile} TestResult ${srcdir}/test_baseline ${ResultFile} # OUTPUT to stdout by default ResultFile=test_result2 ${command} ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline ${ResultFile} # OUTPUT to stdout via - argument ResultFile=test_result3 ${command} ${srcdir}/file1 ${srcdir}/file2 - >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline ${ResultFile} # FILE1 from standard input via - argument ResultFile=test_result4 ${command} - ${srcdir}/file2 <${srcdir}/file1 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline ${ResultFile} # FILE2 from standard input via - argument ResultFile=test_result5 ${command} ${srcdir}/file1 - <${srcdir}/file2 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline ${ResultFile} # Different values for addmark, changemark, deletemark ResultFile=test_result6 ${command} -aA -cC -dD ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline6 ${ResultFile} # Test for accidental file overwrite. ResultFile=test_result7 cp ${srcdir}/file2 tmp_file7 ${command} -aA -dD -cC ${srcdir}/file1 tmp_file7 tmp_file7 \ >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline7 ${ResultFile} # Test -D option ResultFile=test_result8 ${command} -D ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline8 ${ResultFile} # Test -D and -M options ResultFile=test_result9 ${command} -D -M '<<<<' '>>>>' \ ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline9 ${ResultFile} # Test -D and -B options ResultFile=test_result10 ${command} -D -B ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1 TestResult ${srcdir}/test_baseline10 ${ResultFile} # EOF