lib/func.tcl, test/unit: Fix spin in `next-matching-date' and test.
Consider the pattern `*-*-* 10:20:30' applied to the reference date
`2012-12-06 10:21:42'. The year, month and day are wildcards, so they're
fine. The hour matches, so we recurse to the minutes. That match fails,
so the recursive call returns `step'. At this point, we consider the
hours again: we step `nn' on by one to perturb the matching process and
iterate, attempting to match the literal pattern `10'. This will compare
the literal with the original unstepped reference value, which is still
`10', and drag `nn' back down. The result is that we spin, making no
progress and using all available CPU. Of course, the precise values aren't
important: the significant bit is a literal pattern matching the reference
time, followed by a mismatch which forces a step.
Also include a number of tests for this function, because it's the main
algorithmically fiddly piece of the system.