|
Iain Douglas |
342623 |
#!/bin/bash
|
|
Iain Douglas |
342623 |
# Author: Iain Douglas <centos@1n6.org.uk>
|
|
Iain Douglas |
342623 |
|
|
Iain Douglas |
342623 |
# Tests for diff3
|
|
Iain Douglas |
342623 |
|
|
Iain Douglas |
342623 |
# Basic Tests
|
|
Iain Douglas |
342623 |
|
|
Iain Douglas |
342623 |
t_Log "Running $0 - diff3 tests"
|
|
Iain Douglas |
342623 |
|
|
Iain Douglas |
342623 |
diff3 -v &>/dev/null
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
DIR=./tests/p_diffutils
|
|
Athmane Madjoudj |
536354 |
FILES=$DIR/files
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Test the diff3 normal output. As we've already tested diff
|
|
Athmane Madjoudj |
536354 |
# we can now use it to test our output.
|
|
Athmane Madjoudj |
536354 |
echo "Check diff3 normal output"
|
|
Athmane Madjoudj |
536354 |
diff3 $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_normal -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -e output --ed
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -e output"
|
|
Athmane Madjoudj |
536354 |
diff3 -e $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_ed_script -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --ed output"
|
|
Athmane Madjoudj |
536354 |
diff3 --ed $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_ed_script -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -3 --easy-only output
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -3 output"
|
|
Athmane Madjoudj |
536354 |
diff3 -3 $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_easy_only -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --easy-only output"
|
|
Athmane Madjoudj |
536354 |
diff3 --easy-only $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_easy_only -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -x --overlap-only output
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -x output"
|
|
Athmane Madjoudj |
536354 |
diff3 -x $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_overlap_only -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --overlap-only output"
|
|
Athmane Madjoudj |
536354 |
diff3 --overlap-only $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_overlap_only -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -A --show-all option
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -A output"
|
|
Athmane Madjoudj |
536354 |
diff3 -A $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_all -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --show-all output"
|
|
Athmane Madjoudj |
536354 |
diff3 --show-all $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_all -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -E --show-overlap option
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -E output"
|
|
Athmane Madjoudj |
536354 |
diff3 -E $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_overlap -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --show-overlap output"
|
|
Athmane Madjoudj |
536354 |
diff3 --show-overlap $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_overlap -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Iain Douglas |
342623 |
|
|
Athmane Madjoudj |
536354 |
# Check the -m --merge option
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -m output"
|
|
Athmane Madjoudj |
536354 |
diff3 -m $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_merge -
|
|
Iain Douglas |
342623 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --merge output"
|
|
Athmane Madjoudj |
536354 |
diff3 --merge $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_merge -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -i option to write the changes
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -i output"
|
|
Athmane Madjoudj |
536354 |
diff3 -i -3 $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_i -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the -L --label output
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 -L output"
|
|
Athmane Madjoudj |
536354 |
diff3 -m -L LAO -L TZU -L TAO $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_label -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check the diff3 --label= output"
|
|
Athmane Madjoudj |
536354 |
diff3 -m --label=LAO --label=TZU --label=TAO $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_label -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
# Check the --diff-program. Copy /usr/bin/diff to /var/tmp/newdiff then
|
|
Athmane Madjoudj |
536354 |
# use --diff-program=/var/tmp/newdiff to force diff3 to use it.
|
|
Athmane Madjoudj |
536354 |
#
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
echo "Check --diff-program"
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
[[ -e /var/tmp/newdiff ]] && rm /var/tmp/newdiff
|
|
Athmane Madjoudj |
536354 |
cp /usr/bin/diff /var/tmp/newdiff
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
diff3 --diff-program=/var/tmp/newdiff $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_normal -
|
|
Athmane Madjoudj |
536354 |
t_CheckExitStatus $?
|
|
Athmane Madjoudj |
536354 |
|
|
Athmane Madjoudj |
536354 |
rm /var/tmp/newdiff
|