1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
|
#!/bin/sh
#
# $RCSfile$
#
# Copyright (c) 2001-2002, Martin Blais. All rights reserved.
#
# This script is my regression tests. Although every single time I run it i
# feel I'm doing it for nothing, almost every single time I'll find something
# that is buggy about xxdiff. This isn't much as far as testing, but it is much
# better than nothing, and it really does help.
#
function testhdr {
clear
echo "====================================================================="
echo "TESTING:" $1
echo "====================================================================="
}
function waitread {
#echo " <press enter>" && read
read
}
function waitexit {
echo " <exit xxdiff>"
read
}
XXDIFF=../bin/xxdiff
#-------------------------------------------------------------------------------
testhdr "Print version"
$XXDIFF --version
waitread;
#-------------------------------------------------------------------------------
testhdr "Print help"
$XXDIFF --help
waitread;
#-------------------------------------------------------------------------------
testhdr "Print help for Qt options"
$XXDIFF --help-qt
waitread;
#-------------------------------------------------------------------------------
testhdr "Print help for all options"
$XXDIFF --help-all
waitread;
#-------------------------------------------------------------------------------
testhdr "Print HTML documentation"
$XXDIFF --help-html | tee /tmp/out.html
echo "=============================="
echo "Open and check file:/tmp/out.html in your browser"
waitread;
rm -f /tmp/out.html
#-------------------------------------------------------------------------------
testhdr "Testing cmdline: no files. Should print something."
$XXDIFF
waitread;
#-------------------------------------------------------------------------------
testhdr "Testing cmdline: one file only. Should fail."
$XXDIFF mine
waitread;
#-------------------------------------------------------------------------------
testhdr "Testing cmdline: four files. Should fail."
$XXDIFF mine older yours empty
waitread;
#-------------------------------------------------------------------------------
testhdr "Testing cmdline: one directory. Should fail."
$XXDIFF dir1
waitread;
#-------------------------------------------------------------------------------
testhdr "Testing cmdline: three directories. Should fail."
$XXDIFF dir1 dir2 dir3
waitread;
#-------------------------------------------------------------------------------
testhdr "Testing cmdline: two files and one directory. Should fail."
$XXDIFF mine older dir1
waitread;
#-------------------------------------------------------------------------------
testhdr "Stat test: file that does not exist. Should fail."
$XXDIFF mine filedoesnotexist
waitread;
#-------------------------------------------------------------------------------
testhdr "Stat test: directory that does not exist. Should fail."
$XXDIFF dir1 dirdoesnotexist
waitread;
#-------------------------------------------------------------------------------
testhdr "Listing resources"
$XXDIFF --list-resources | tee /tmp/xxdiffrc
waitread;
#-------------------------------------------------------------------------------
testhdr "Opening xxdiff with output resources. There should be no warnings here."
XXDIFFRC=/tmp/xxdiffrc $XXDIFF mine mine
waitexit;
rm -f /tmp/xxdiffrc
#-------------------------------------------------------------------------------
testhdr "Testing --no-rcfile"
$XXDIFF --no-rcfile mine mine
waitexit;
#-------------------------------------------------------------------------------
testhdr "Testing --orig-xdiff"
$XXDIFF --no-rcfile --orig-xdiff mine older
waitexit;
#-------------------------------------------------------------------------------
testhdr "Normal 2-way diff"
$XXDIFF mine older
waitexit;
#-------------------------------------------------------------------------------
testhdr "Normal 3-way diff"
$XXDIFF mine older yours
waitexit;
#-------------------------------------------------------------------------------
testhdr "Normal 2-way dir. diff"
$XXDIFF dir1 dir3
waitexit;
#-------------------------------------------------------------------------------
testhdr "Normal 2-way recursive dir. diff"
$XXDIFF -r dir1 dir3
waitexit;
#-------------------------------------------------------------------------------
testhdr "3-way with auto merge"
$XXDIFF --merge mine older yours
waitexit;
#-------------------------------------------------------------------------------
testhdr "Empty files: 2-way with one empty file"
$XXDIFF empty yours
waitexit;
#-------------------------------------------------------------------------------
testhdr "Empty files: 2-way with two empty files"
$XXDIFF empty empty
waitexit;
#-------------------------------------------------------------------------------
testhdr "Empty files: 3-way with one empty file"
$XXDIFF mine empty yours
waitexit;
#-------------------------------------------------------------------------------
testhdr "Empty files: 3-way with two empty files"
$XXDIFF mine empty empty
waitexit;
#-------------------------------------------------------------------------------
testhdr "Empty files: 3-way with three empty files"
$XXDIFF empty empty empty
waitexit;
#-------------------------------------------------------------------------------
testhdr "File with incomplete line"
$XXDIFF incomplete mine
waitexit;
#-------------------------------------------------------------------------------
testhdr "Qt options (misc)"
echo "Simple cmap option"
$XXDIFF --cmap mine yours
waitexit;
echo "Simple visual option"
$XXDIFF --visual TrueColor mine yours
echo "Style option"
$XXDIFF --style=platinum mine yours
waitexit;
echo "Qt options (geometry), this should show up 400x400"
$XXDIFF --geometry 400x400 mine yours
waitexit;
#-------------------------------------------------------------------------------
testhdr "Unmerge with two files. Should fail."
$XXDIFF --unmerge unmerge/basic unmerge/contig
waitexit;
#-------------------------------------------------------------------------------
testhdr "Unmerge with one file. Should work."
$XXDIFF --unmerge unmerge/basic
waitexit;
#-------------------------------------------------------------------------------
testhdr "Unmerge3 with one file. Should work."
$XXDIFF --unmerge3 unmerge/diff3merge
waitexit;
#-------------------------------------------------------------------------------
#
# TODO
#
# ^L rendering, accents
# save as conflicts, 2, 3
# save as ifdefs, 2, 3
# test return values
|