From ac2cf2cb3ea36388437aab17d31e1c5e984d9693 Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Mon, 20 Jun 2022 23:47:25 +0100 Subject: fix(repl): accept tab when previous character is whitespace (#14898) --- cli/tests/integration/repl_tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cli/tests/integration') diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index 47d366091..a6c053675 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -804,3 +804,25 @@ fn pty_clear_function() { assert!(output.contains("3234")); }); } + +#[test] +fn pty_tab_handler() { + // If the last character is **not** whitespace, we show the completions + util::with_pty(&["repl"], |mut console| { + console.write_line("a\t\t"); + console.write_line("close();"); + let output = console.read_all_output(); + assert!(output.contains("addEventListener")); + assert!(output.contains("alert")); + assert!(output.contains("atob")); + }); + // If the last character is whitespace, we just insert a tab + util::with_pty(&["repl"], |mut console| { + console.write_line("a \t\t"); // last character is whitespace + console.write_line("close();"); + let output = console.read_all_output(); + assert!(!output.contains("addEventListener")); + assert!(!output.contains("alert")); + assert!(!output.contains("atob")); + }); +} -- cgit v1.2.3