| 134 | |
| 135 | |
| 136 | def test_getchar(): |
| 137 | @click.command() |
| 138 | def continue_it(): |
| 139 | click.echo(click.getchar()) |
| 140 | |
| 141 | runner = CliRunner() |
| 142 | result = runner.invoke(continue_it, input="y") |
| 143 | assert not result.exception |
| 144 | assert result.output == "y\n" |
| 145 | |
| 146 | runner = CliRunner(echo_stdin=True) |
| 147 | result = runner.invoke(continue_it, input="y") |
| 148 | assert not result.exception |
| 149 | assert result.output == "y\n" |
| 150 | |
| 151 | @click.command() |
| 152 | def getchar_echo(): |
| 153 | click.echo(click.getchar(echo=True)) |
| 154 | |
| 155 | runner = CliRunner() |
| 156 | result = runner.invoke(getchar_echo, input="y") |
| 157 | assert not result.exception |
| 158 | assert result.output == "yy\n" |
| 159 | |
| 160 | runner = CliRunner(echo_stdin=True) |
| 161 | result = runner.invoke(getchar_echo, input="y") |
| 162 | assert not result.exception |
| 163 | assert result.output == "yy\n" |
| 164 | |
| 165 | |
| 166 | def test_catch_exceptions(): |