Skip to content

Additional unit tests for anchored searches

FeRD (Frank Dana) requested to merge ferdnyc/recoll:anchor-unit-tests into master

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.

tryanchor2.html

In setting up to run the tests, I also made two small modifications to runtests.sh, both included as separate commits:

  1. Use mkdir -p to create the temp directory, in case $HOME/temp/ doesn't exist
  2. Remove the rewriting of tests/config/recoll.conf from the rerootResults 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 (when sed processes recoll.conf.in into a new recoll.conf), so there's no point in trying to edit the contents there.

Merge request reports