summaryrefslogtreecommitdiff
path: root/cli/tests/integration/repl_tests.rs
diff options
context:
space:
mode:
authorsigmaSd <bedisnbiba@gmail.com>2022-06-20 23:47:25 +0100
committerGitHub <noreply@github.com>2022-06-20 18:47:25 -0400
commitac2cf2cb3ea36388437aab17d31e1c5e984d9693 (patch)
tree52e953e0bc3a40bda55d8f2cf3fb1b02736b27da /cli/tests/integration/repl_tests.rs
parenta7339f756c5f871026ab080e849d3dd37f2ca124 (diff)
fix(repl): accept tab when previous character is whitespace (#14898)
Diffstat (limited to 'cli/tests/integration/repl_tests.rs')
-rw-r--r--cli/tests/integration/repl_tests.rs22
1 files changed, 22 insertions, 0 deletions
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"));
+ });
+}