diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 6d5182a297..cd90315b3c 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1844,13 +1844,40 @@ mod integration { let deno_exe = util::deno_exe_path(); let fork = Fork::from_ptmx().unwrap(); if let Ok(mut master) = fork.is_parent() { - master.write_all(b"Deno.internal\t\n").unwrap(); + master.write_all(b"Symbol.it\t\n").unwrap(); master.write_all(b"close();\n").unwrap(); let mut output = String::new(); master.read_to_string(&mut output).unwrap(); - assert!(output.contains("Symbol(Deno.internal)")); + assert!(output.contains("Symbol(Symbol.iterator)")); + + fork.wait().unwrap(); + } else { + std::env::set_var("NO_COLOR", "1"); + let err = exec::Command::new(deno_exe).arg("repl").exec(); + println!("err {}", err); + unreachable!() + } + } + + #[cfg(unix)] + #[test] + fn pty_ignore_symbols() { + use std::io::Read; + use util::pty::fork::*; + let deno_exe = util::deno_exe_path(); + let fork = Fork::from_ptmx().unwrap(); + if let Ok(mut master) = fork.is_parent() { + master.write_all(b"Array.Symbol\t\n").unwrap(); + master.write_all(b"close();\n").unwrap(); + + let mut output = String::new(); + master.read_to_string(&mut output).unwrap(); + + assert!(output.contains("undefined")); + assert!(!output + .contains("Uncaught TypeError: Array.Symbol is not a function")); fork.wait().unwrap(); } else { diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index 73d1688e53..ce0879a852 100644 --- a/cli/tools/repl.rs +++ b/cli/tools/repl.rs @@ -115,8 +115,19 @@ impl Completer for Helper { .as_array() .unwrap() .iter() - .map(|r| r.get("name").unwrap().as_str().unwrap().to_string()) - .filter(|r| r.starts_with(&suffix[1..])) + .filter_map(|r| { + let name = r.get("name").unwrap().as_str().unwrap().to_string(); + + if name.starts_with("Symbol(") { + return None; + } + + if name.starts_with(&suffix[1..]) { + return Some(name); + } + + None + }) .collect(); return Ok((pos - (suffix.len() - 1), candidates));