add test for nonumbers parameter

This commit is contained in:
Jean-Francois Dockes 2020-08-21 19:21:35 +02:00
parent e771a24148
commit 4588e1c73c
2 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,76 @@
#!/bin/sh
thisdir=`dirname $0`
topdir="$thisdir"/..
. "$topdir"/shared.sh
initvariables $0
docdir=`mktemp -d --tmpdir rcltest.XXXX`
test -d "$docdir" || exit 1
cleanup()
{
rm -f "$docdir"/docnonumbers.txt
rm -rf "$docdir"/config
rmdir "$docdir"
}
trap cleanup 0 2 15
cat > "$docdir"/docnonumbers.txt <<EOF
7569373329
+5858383546
-8499393438
88738.87243
EOF
RECOLL_CONFDIR="$docdir"/config/
mkdir "$RECOLL_CONFDIR" || exit 1
export RECOLL_CONFDIR
mkconf()
{
nonumbers=$1
egrep 'cachedir|loglevel|logfilename|idxlogfilename' \
../config/recoll.conf > \
"$RECOLL_CONFDIR"/recoll.conf
cat >> "$RECOLL_CONFDIR"/recoll.conf <<EOF
noaspell = 1
indexstemminglanguages=
topdirs = $docdir
nonumbers = $nonumbers
EOF
}
idxandquery()
{
nonumbers=$1
recollindex -c "$RECOLL_CONFDIR" -z
echo "Running queries with nonumbers=$nonumbers" >> $mystdout
(
for w in 7569373329 "+5858383546" "-8499393438" "88738.87243" ; do
echo querying for $w
recollq -a -S url -q " $w"
done
) 2> $mystderr | egrep -v '^Recoll query: ' >> $mystdout
}
cp /dev/null $mystdout
nonumbers=1
mkconf $nonumbers
idxandquery $nonumbers
nonumbers=0
mkconf $nonumbers
idxandquery $nonumbers
# Have to delete the tempdir name from the output for comparison
sed -i -e "s,$docdir,,g" $mystdout
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1
checkresult

View File

@ -0,0 +1,18 @@
Running queries with nonumbers=1
querying for 7569373329
querying for +5858383546
querying for -8499393438
querying for 88738.87243
Running queries with nonumbers=0
querying for 7569373329
1 results
text/plain [file:///docnonumbers.txt] [docnonumbers.txt] 47 bytes
querying for +5858383546
1 results
text/plain [file:///docnonumbers.txt] [docnonumbers.txt] 47 bytes
querying for -8499393438
1 results
text/plain [file:///docnonumbers.txt] [docnonumbers.txt] 47 bytes
querying for 88738.87243
1 results
text/plain [file:///docnonumbers.txt] [docnonumbers.txt] 47 bytes