summaryrefslogtreecommitdiff
path: root/cli/tests/integration/repl_tests.rs
diff options
context:
space:
mode:
authorColin Ihrig <cjihrig@gmail.com>2022-04-20 15:48:15 -0400
committerGitHub <noreply@github.com>2022-04-20 15:48:15 -0400
commit2a93c134dc93d70b5f6ea9d417c88207661884d5 (patch)
tree09fecb2f1c44da117309e2ad436ffa56860c9b6e /cli/tests/integration/repl_tests.rs
parentf785ecee1a68faac517a6d35763dd26ef033d722 (diff)
feat(repl): add global clear() function (#14332)
This commit adds a clear() function in the REPL which works similar to console.clear().
Diffstat (limited to 'cli/tests/integration/repl_tests.rs')
-rw-r--r--cli/tests/integration/repl_tests.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs
index a63be3ece..05a17d4b7 100644
--- a/cli/tests/integration/repl_tests.rs
+++ b/cli/tests/integration/repl_tests.rs
@@ -761,3 +761,21 @@ fn eval_file_flag_multiple_files() {
assert!(out.contains("helloFOO"));
assert!(err.contains("Download"));
}
+
+#[test]
+fn pty_clear_function() {
+ util::with_pty(&["repl"], |mut console| {
+ console.write_line("console.log('hello');");
+ console.write_line("clear();");
+ console.write_line("const clear = 1 + 2;");
+ console.write_line("clear;");
+ console.write_line("close();");
+
+ let output = console.read_all_output();
+ assert!(output.contains("hello"));
+ assert!(output.contains("[1;1H"));
+ assert!(output.contains("undefined"));
+ assert!(output.contains("const clear = 1 + 2;"));
+ assert!(output.contains('3'));
+ });
+}