diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-10-19 22:54:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 16:54:50 +0200 |
commit | 35028db5e571b4232dd58293cea7e5a8ec2e3571 (patch) | |
tree | 285499dda612ea88ce3a9766233419f0f7a7c0d5 /cli/tests/integration_tests.rs | |
parent | e432db70e9b5628990517baa689b74721f6da8e1 (diff) |
fix(cli/repl): unterminated string literal should invalidate (#7896)
This adds the grave character to the pair matching so that template
string literals trigger multi-line edits.
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r-- | cli/tests/integration_tests.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 5bf1a5a85..fdf2425cd 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1127,6 +1127,40 @@ fn run_watch() { drop(t); } +#[cfg(unix)] +#[test] +fn repl_test_pty_multiline() { + use std::io::Read; + use util::pty::fork::*; + + let tests_path = util::tests_path(); + let fork = Fork::from_ptmx().unwrap(); + if let Ok(mut master) = fork.is_parent() { + master.write_all(b"(\n1 + 2\n)\n").unwrap(); + master.write_all(b"{\nfoo: \"foo\"\n}\n").unwrap(); + master.write_all(b"`\nfoo\n`\n").unwrap(); + master.write_all(b"close();\n").unwrap(); + + let mut output = String::new(); + master.read_to_string(&mut output).unwrap(); + + assert!(output.contains('3')); + assert!(output.contains("{ foo: \"foo\" }")); + assert!(output.contains("\"\\nfoo\\n\"")); + + fork.wait().unwrap(); + } else { + util::deno_cmd() + .current_dir(tests_path) + .env("NO_COLOR", "1") + .arg("repl") + .spawn() + .unwrap() + .wait() + .unwrap(); + } +} + #[test] fn repl_test_console_log() { let (out, err) = util::run_and_collect_output( |