[Chapel Merge] Fix re2 c++ tests

Branch: refs/heads/main
Revision: f43cf87
Author: mppf
Link: Unavailable
Log Message:

Merge pull request #20738 from mppf/fix-re2-c++-tests

Fix re2 c++ tests

[PR includes contributions from @cassella - thanks!]

Closes #20723

This PR fixes test/regex/ferguson/ctests so that it is no longer accidentally skipped and fixes a bug in the RE2 customizations while doing so. Thanks to @cassella for noticing this problem and making improvements to these tests.

The bug was that the loop in prefix_accel would run forever because it did not use the FileSearchPtr comparison to find the end. Note that some of this code is using std::max<ssize_t> as a value to indicate "until the end of the file" but FileSearchPtr handles such details in its < overload.

Reviewed by @benharsh - thanks!