D-Programming-Language/phobos — pull request #892 by monarchdodra (2012-10-26 10:17:52+00:00)
Title: Fix findSplit on non-RA ranges

This fixes a bug in findSplit. The conditions to recreating the bug where:

1. Given forward ranges that are not RA (or that are infinite)
2. If the needle makes a partial match at the end of haystack (for example: H = "abc", N = "bcd")

Then findsplit will consider this is a match, and return: ["a", "bc", ""] instead of ["abc", "", ""].

Also inside this pull:
1. More thorough restrictions for calling findsplit.
2. More thoroughly checks that hasLength!R1 && hasSlicing!R1 before taking the fast road.
3. More tests to check reference ranges, input ranges, and infinite ranges.
4. More tests to try to confuse findSplit with special case matches

findSplit actually had correct support for reference ranges, but adding the unittests now also means we can *trust* it, and that we can hope it won't break in the future either.

NOTA: I found the issue while testing count: The bug was causing it to always find an extra match at the end of the ForwardRanges.

(Will squash tonight)