From af4912ed0d1c679716c7776610a6b7eb4c806f85 Mon Sep 17 00:00:00 2001 From: Ayato Tokubi Date: Mon, 19 Jul 2021 12:38:13 +0000 Subject: fix(repl): output error without hanging when input is invalid (#11426) --- cli/tests/integration/repl_tests.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index bfb849ed6..955c27069 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -71,6 +71,23 @@ fn pty_bad_input() { }); } +#[cfg(unix)] +#[test] +fn pty_syntax_error_input() { + use std::io::{Read, Write}; + run_pty_test(|master| { + master.write_all(b"('\\u')\n").unwrap(); + master.write_all(b"('\n").unwrap(); + master.write_all(b"close();\n").unwrap(); + + let mut output = String::new(); + master.read_to_string(&mut output).unwrap(); + + assert!(output.contains("Unterminated string constant")); + assert!(output.contains("Unexpected eof")); + }); +} + #[cfg(unix)] #[test] fn pty_complete_symbol() { -- cgit v1.2.3