diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-02-05 19:09:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 12:09:52 +0100 |
commit | c83e261b42019f5a1ef1b67f9c764a3ed61b68a2 (patch) | |
tree | 810ed558e98ace3a23977c76b31bec0af7021b88 /cli/tests/integration_tests.rs | |
parent | 5b9376908af91ca723245b78d3146c1f17107ac4 (diff) |
fix(repl): prevent symbol completion panic (#9400)
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 dd6b740e3..c79988412 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1751,6 +1751,31 @@ mod integration { } } + #[cfg(unix)] + #[test] + fn pty_complete_symbol() { + 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"Deno.internal\t\n").unwrap(); + master.write_all(b"close();\n").unwrap(); + + let mut output = String::new(); + master.read_to_string(&mut output).unwrap(); + + assert!(output.contains("Symbol(Deno.internal)")); + + 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] fn console_log() { let (out, err) = util::run_and_collect_output( |