[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Found bug - need new test? or modify existing test?

Gibbs Tanton - tgibbs

7/5/2005 9:00:00 PM

Typically you want to add a new test. This preserves your "history" of
test cases. It also helps isolate tests so that they only test as
little as possible, which will help you isolate the problem when things
go wrong.

-----Original Message-----
From: Joe Van Dyk [mailto:joevandyk@gmail.com]
Sent: Tuesday, July 05, 2005 3:41 PM
To: ruby-talk ML
Subject: Found bug - need new test? or modify existing test?

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.



**********************************************************************
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.