Additional unit tests for anchored searches
This MR, as proposed in #94 (closed), adds additional test cases to tests/anchor/anchor.sh
intended to catch errors using anchored matches with the distance parameter specified. Both 0-word- and 1-word-distance searches are added to various anchored scenarios in both the body and title search tests.
I have verified that these tests succeed with the current code (after the merge of d3d63946, fixing #94 (closed)), and that they fail as expected when run against recoll 1.30.1.
The tests rely on an additional test file tryanchor2.html
(attached), expected to be found alongside tryanchor.html
in <testdata>/anchor/
. It is largely a copy of tryanchor.html
, with a few extra strings added at the beginnings and endings of the title and body content.
In setting up to run the tests, I also made two small modifications to runtests.sh
, both included as separate commits:
- Use
mkdir -p
to create the temp directory, in case$HOME/temp/
doesn't exist - Remove the rewriting of
tests/config/recoll.conf
from thererootResults
shell function. On early runs that file won't exist yet, and even if it does exist it'll be overwritten a few lines later in the script (whensed
processesrecoll.conf.in
into a newrecoll.conf
), so there's no point in trying to edit the contents there.