Re:Absolute truths I unlearned as junior developer
by skybrian on Friday June 07, 2019 @05:17PM
(#20128693)
For unit testing, I suggest starting with parsers, or any string-parsing code you have. They tend to be nicely self-contained and have lots of edge cases that you can test in a data-driven way, using a loop.
Even if you're just using a regular expression for parsing, it can be worth moving the parsing code to its own function and testing it like a parser.
Even if you're just using a regular expression for parsing, it can be worth moving the parsing code to its own function and testing it like a parser.