summaryrefslogtreecommitdiff
path: root/cli/tests/integration/repl_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-15 21:41:13 -0400
committerGitHub <noreply@github.com>2023-03-15 21:41:13 -0400
commitc1eba16b84c5bba4f7fdf05beb6ccf5e0fd1da16 (patch)
tree8ce89ad74652f0f47daead27adc5b61ff4fa455a /cli/tests/integration/repl_tests.rs
parent48a0b7f98f568bb5c3a15b487459569e38e4c671 (diff)
fix(repl): do not panic deleting `Deno` or deleting all its properties (#18211)
Closes #18194 Closes #12092
Diffstat (limited to 'cli/tests/integration/repl_tests.rs')
-rw-r--r--cli/tests/integration/repl_tests.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs
index efbde55c3..aafb3bb48 100644
--- a/cli/tests/integration/repl_tests.rs
+++ b/cli/tests/integration/repl_tests.rs
@@ -223,6 +223,36 @@ fn pty_assign_global_this() {
}
#[test]
+fn pty_assign_deno_keys_and_deno() {
+ util::with_pty(&["repl"], |mut console| {
+ console.write_line(
+ "Object.keys(Deno).forEach((key)=>{try{Deno[key] = undefined} catch {}})",
+ );
+ console.write_line("delete globalThis.Deno");
+ console.write_line("console.log('testing ' + 'this out')");
+ console.write_line("close();");
+
+ let output = console.read_all_output();
+ assert_not_contains!(output, "panicked");
+ assert_contains!(output, "testing this out");
+ });
+}
+
+#[test]
+fn pty_internal_repl() {
+ util::with_pty(&["repl"], |mut console| {
+ console.write_line("globalThis");
+ console.write_line("__\t\t");
+ console.write_line("close();");
+ let output = console.read_all_output();
+ assert_contains!(output, "__defineGetter__");
+ // should not contain the internal repl variable
+ // in the `globalThis` or completions output
+ assert_not_contains!(output, "__DENO_");
+ });
+}
+
+#[test]
fn pty_emoji() {
// windows was having issues displaying this
util::with_pty(&["repl"], |mut console| {