4 ms·
Someday, you'll want to run your code more than once, and you'll write tests instead of typing them into the REPL.
by jrockway 16y ago
Someday, you'll want to run your code more than once, and you'll write tests instead of typing them into the REPL.
- eropple 16y agoPrint statements aren't meaningful tests, though. Hence the eight hojillion xUnit ports for pretty much every major language.
- jrockway 16y agoOK, so say you have some test that creates a foobar object and invokes the method baz, which does some stuff that you care about. The test fails. What do you do? Do you pick apart the implementation of baz in the REPL, or do you add some print statements inside baz? The second option is easier. You obviously remove them once your understanding (and tweaking) of the code leads to a passing test.
- japherwocky 16y agoyou set a trace point inside baz, investigate with the REPL, and fix your code.
- japherwocky 16y agowait.. what? are you scanning stdout with your tests?