diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-12-15 00:37:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-14 11:37:08 -0500 |
commit | ce6b738ac08b66b0ee8bfa3f17f8510ab094d5d9 (patch) | |
tree | 17451cbc28396e7da39e3b72259f9f3ac89c7b96 /cli/tests/integration_tests.rs | |
parent | 8f8749095c0dc5e71104228de650f671674f6fdc (diff) |
fix(repl): recover from invalid input (#8759)
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r-- | cli/tests/integration_tests.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index cb6dfad6d..e4de423ee 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1656,6 +1656,31 @@ fn repl_test_pty_unpaired_braces() { } } +#[cfg(unix)] +#[test] +fn repl_test_pty_bad_input() { + use std::io::Read; + use util::pty::fork::*; + let deno_exe = util::deno_exe_path(); + let fork = Fork::from_ptmx().unwrap(); + if let Ok(mut master) = fork.is_parent() { + master.write_all(b"'\\u{1f3b5}'[0]\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 literal")); + + fork.wait().unwrap(); + } else { + std::env::set_var("NO_COLOR", "1"); + let err = exec::Command::new(deno_exe).arg("repl").exec(); + println!("err {}", err); + unreachable!() + } +} + #[test] #[ignore] fn run_watch_with_importmap_and_relative_paths() { |