diff options
Diffstat (limited to 'cli/tests/integration')
-rw-r--r-- | cli/tests/integration/repl_tests.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index aafb3bb48..52510a637 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -655,6 +655,52 @@ fn missing_deno_dir() { } #[test] +fn custom_history_path() { + use std::fs::read; + let temp_dir = TempDir::new(); + let history_path = temp_dir.path().join("history.txt"); + let (out, err) = util::run_and_collect_output( + true, + "repl", + Some(vec!["1"]), + Some(vec![ + ( + "DENO_REPL_HISTORY".to_owned(), + history_path.to_str().unwrap().to_owned(), + ), + ("NO_COLOR".to_owned(), "1".to_owned()), + ]), + false, + ); + assert!(read(&history_path).is_ok()); + assert_ends_with!(out, "1\n"); + assert!(err.is_empty()); +} + +#[test] +fn disable_history_file() { + let deno_dir = util::new_deno_dir(); + let default_history_path = deno_dir.path().join("deno_history.txt"); + let (out, err) = util::run_and_collect_output( + true, + "repl", + Some(vec!["1"]), + Some(vec![ + ( + "DENO_DIR".to_owned(), + deno_dir.path().to_str().unwrap().to_owned(), + ), + ("DENO_REPL_HISTORY".to_owned(), "".to_owned()), + ("NO_COLOR".to_owned(), "1".to_owned()), + ]), + false, + ); + assert!(!default_history_path.try_exists().unwrap()); + assert_ends_with!(out, "1\n"); + assert!(err.is_empty()); +} + +#[test] fn save_last_eval() { let (out, err) = util::run_and_collect_output( true, |