diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fs.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -524,6 +524,18 @@ def python_repl_runs_one_line(binary): record = b'MX0 0 0 %d %s\n' % (len(line), line) client.rpc(118, struct.pack('<IQI', fid, 0, len(record)) + record) assert wait_for(f'\n{1000 + n}'), (n, body()) + # More than one line, with and without a newline at the end, + # and a block with a statement after it: each runs whole, + # and the REPL is back at its prompt, not at `...`. + for code, outputs in [(b'print(11)\nprint(22)', ['11', '22']), + (b'print(33)\nprint(44)\n', ['33', '44']), + (b'for i in range(2):\n print(55 + i)\nprint(77)\n', ['55', '56', '77'])]: + record = b'MX0 0 0 %d %s\n' % (len(code), code) + client.rpc(118, struct.pack('<IQI', fid, 0, len(record)) + record) + for out in outputs: + assert wait_for(f'\n{out}\n'), (code, out, body()) + time.sleep(.5) + assert body().rstrip().endswith('>>>'), (code, body()[-200:]) finally: client.close(fid) |
