>>>> "Sean" == Sean MacLennan
<seanm(a)seanm.ca> writes:
Sean> Stephen J. Turnbull writes:
> I checked what I could think of at the time. There's no
reason
> not to add more if you can think of them.
Sean> The problem with regexps is that there are too many border
Sean> conditions. You could right 1,000,000 tests, and still miss
Sean> one :-(
Doesn't mean we shouldn't try to approximate it. If you can thinks of
new tests, please don't hesitate to suggest them. (BTW, have you
signed, or would you be willing to sign an FSF assignment, for tests?
It would be a shame, Martin's theories on test suites not
withstanding, if we didn't eventually contribute this to GNU Emacs.)
> Not if you do it the way I did, fixing the bug with changes
> restricted to the compound statement controlled by the
> `wordbound:' label.
Sean> Ahhh, but my patch moves one `if' to the notwordbound: case,
Sean> since it does not make sense in the wordbound: case (and in
Sean> fact causes the 'known bug').
That whole approach is wrong, IMHO, because it makes verifying the
code twice as hard. At least, I can come up with no conditions where
\B != not \b when that code is reached. Thus you only have to check
one. With your method, all test cases need to be checked on both
paths since they use different code to handle them.
Furthermore, your patch probably introduces a crash, because you
indeed can "fall off the end" of a Lisp string. There's no guarantee
that &string + length(string) is in the data segment, let alone that
it is '\000'. (In fact, allowing NUL bytes in strings is one of the
reasons why Lisp doesn't use the C representation for strings.) So
you _must_ check for AT_STRINGS_END(d) in both cases.
Finally, I suspect that \B will fail the corresponding tests using
your patch. You've just "moved the bug" into the other branch of
execution!:-)
Two notes on patch style: don't use // comments in C code; most
platforms don't support it. Second, that particular comment is
unneeded. If you comment on code written by someone else, it _may_ be
appropriate to include some identifier so that you can be asked what
in the world you were thinking. But code changes, if accepted, should
speak for themselves---if they don't, explain in an explicit comment
(and author identity will be in the ChangeLog).
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.