Tests exit with correct exit code