This adds test coverage for the shell.exit() function. This also
refactors how we mock stdout/stderr and adds support for mocking
process.exit() (which was needed for this change).
While I was writing these tests, I realized there was an edge case I
missed in PR #1122. This change fixes that edge case.
Issue #1013
* Add stdout/stderr test mocks
* Mock stdout/stderr during echo tests
* Fix lint issues
* Use 'use strict'
* Re-implement mocks as a prototype
* Implement mocks as a single-instance
* Remove redundant test
* Create mocked stdout/stderr.write methods once
* Add newline to output of echo (#557)
* Add newline to output of echo
* Add test
* Throw an error if the options string does not start with '-' (#615)
* Throw an error if the options string does not start with '-'
* Add test
* Change message grammar
* Add -n option to echo
* Fix null argument issue
* Add -n tests
* Add documentation
* Add -en escaped character test
* Add function to parse options for echo
* Use parseOptions to parse echo options
* Simplify control flow
* parseOptions throws now
* Allow null to be echoed
* Prevent echo stderr on unrecognized option
* Add test to check stderr of returned value
* Use consistent variable name
* Change test message, leave TODO about console output