Or, as W. E. Deming wrote: "You cannot inspect quality into a product."
After three years of working on some software (basically some fancy shell scripting but in Python), when the project had grown dramatically beyond its original scope through a host of hacks and bolted-on features, I remembered that the software had unit tests and ran them.
Surprisingly, all the unit tests passed, and my first thought when I saw that was "Man, I bet these unit tests are awful."
And it's extremely hard to write unit tests for crappy code.
Extremely hard to write _good_ unit tests for crappy code.