Joe Van Dyk
7/5/2005 8:41:00 PM
So, I'm developing some software. It's still pretty early in
development. I have a bunch of tests for the software.
Say I come across a bug that exposes a boundry condition that I didn't
test for.
Should I
a. Modify the test that is responsible for that area of the code to
test for that extra condition.
b. Add a new test that duplicates everything of the test that
supposed to test that area correctly and also tests for the boundry
condition?
In my case, I have a function that's responsible for scanning a string like
"id: 1, x_pos: 23, y_pos: 34 | id: 2, x_pos: 34, y_pos: 34 | "
I was splitting the string at "|" and then doing a regex for id and so
on. But if there's a " | ", then the last thing String#split will
return is a space, and doing a regex on that space for /id:/ messes
things up. So either I could modify the test function to include that
extra " | " at the end, or have a new function that tests for that.