"the only way to test the output of a change is to actually deploy it in production."
One program in the system I looked after had been written by a programmer who, thankfully, had left long ago. It always annoyed me because of her odd programming style. It largely consisted of much the same code repeated multiple times. It was ripe for refactoring as we say now but maybe not at the time.
Late one afternoon I decided to tackle it.
One block of code was repeated several times. Copy that into a function and replace all the repetitions with a function call. Very straightforward. This must have shrunk the LoC to about half.
The remainder of the repetition consisted of two similar but not quite identical blocks of code each repeated several times. Not quite so straightforward. Copy one version into a new function adding a switch parameter then add the different sections of the version using the switch parameter to decide which t call.
Replace the repetitions with function calls taking care to use the correct value of the switch.
We now have a much simpler program, a fraction of its original size. It ought to be easier to understand what it's supposed to do which was one of the objectives of the change. But the remainder is still a bit of a tangled mess. Sorting through it to work out just what data would be need to test all the alternative paths would still take ages.
Well it was really all very much a mechanical replacement - the same code is being run, just from one of the two new functions instead of inline. Of course it must still work exactly the same as before.
It was now early evening. Why not put it live?
So I put it live.
Of course it worked exactly the same as before - what did you expect?