-
Book Overview & Buying
-
Table Of Contents
Test-Driven Development with C++
By :
We need to remove the line number from the confirm failure reason so that tests can be given an expected failure reason that won’t change as the test is moved or shifted to different locations in the source code file.
This type of change is called refactoring. We’re not going to make any changes that cause different or new behaviors to appear in the code. At least, that’s the goal. Using TDD will help you refactor your code because you should already have tests in place for all of the important aspects.
Refactoring with proper tests lets you verify that nothing has changed. Many times, refactoring without TDD is avoided because the risk of introducing new bugs is too great. This tends to make problems bigger, as the refactoring is delayed or avoided entirely.
We have a problem with the line numbers. We could ignore the problem and just update the tests with new line numbers in the expected failure messages anytime...