# Should answers include unit tests?

If I'm answering someone's question, instead of saying "your code will fail on input x, y or z", should I provide a unit test snippet?

I don't think it's bad to include a reproducible test-case that shows where the code went wrong. But don't get bogged down in anything irrelevant to the task at hand. So don't bother writing a full testing harness, just post the relevant bit. So if it's a function that throws an exception when fed foo:
func('foo'); // <-- throws exception