Is it OK to write self-tests for a module that depends on user-input, or is this normally not done because the chance of the user making mistakes on input is too great?
Edit:
Suppose I have a function which returns Hello World when the user hits the up_key — then before testing the consequences of a wrong key-hit I would like to test whether the function returns really Hello World if the up_key was pressed.
It is normal to write tests for a unit which requires input in part because “the user makes mistakes”. You have to determine the difference between valid and invalid input. The unit/module should be tested not just to see that it does the right thing with valid input, but also that it does the right thing with invalid input (eg, recognizes it as such and returns an appropriate error).
Ie, part of the test should be intentionally feeding in invalid input.