From 4f761e7cc9075e155367df7acd3b266a1b936772 Mon Sep 17 00:00:00 2001 From: Zhenping Zhao Date: Sat, 21 Dec 2024 03:29:50 -0800 Subject: [PATCH] Add test case for 'save' --- crates/nu-command/tests/commands/ls.rs | 1 - crates/nu-command/tests/commands/save.rs | 26 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/tests/commands/ls.rs b/crates/nu-command/tests/commands/ls.rs index e32434d169..7ac135b511 100644 --- a/crates/nu-command/tests/commands/ls.rs +++ b/crates/nu-command/tests/commands/ls.rs @@ -884,7 +884,6 @@ fn support_pwd_per_drive() { open test_folder\result.out.txt "# ); - eprintln!("std out: {}", _actual.out); assert_eq!(_actual.out, r"X:\test_folder_on_x\test_file_on_x.txt"); assert!(_actual.err.is_empty()); }) diff --git a/crates/nu-command/tests/commands/save.rs b/crates/nu-command/tests/commands/save.rs index 6b77160bee..36f7349c10 100644 --- a/crates/nu-command/tests/commands/save.rs +++ b/crates/nu-command/tests/commands/save.rs @@ -525,3 +525,29 @@ fn parent_redirection_doesnt_affect_save() { assert_eq!(actual.trim_end(), ""); }) } + +#[cfg(windows)] +#[test] +fn support_pwd_per_drive() { + Playground::setup("save_test_pwd_per_drive", |dirs, sandbox| { + sandbox.mkdir("test_folder"); + let _actual = nu!( + cwd: dirs.test(), + r#" + subst X: /D | touch out + subst X: test_folder + x: + mkdir test_folder_on_x + cd - + x:test_folder_on_x\ + touch test_file_on_x.txt + cd - + ls test_folder | get name | save x:result.out.txt + subst X: /D | touch out + open test_folder\test_folder_on_x\result.out.txt + "# + ); + assert_eq!(_actual.out, r"test_folder\test_folder_on_x"); + assert!(_actual.err.is_empty()); + }) +}