From e3e1e6f81bd18394ee9a4d5d27a42c3c334edc0a Mon Sep 17 00:00:00 2001 From: HiranmayaGundu Date: Mon, 22 Jun 2020 00:32:58 +0530 Subject: [PATCH] Adds a test case for changing drives using drive letter in Windows (#2022) * added test case to test check switching drives using drive letter in windows * modified test case to not use config, assert file exists --- crates/nu-cli/tests/commands/cd.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/nu-cli/tests/commands/cd.rs b/crates/nu-cli/tests/commands/cd.rs index d9c12bb96..1d7455c9a 100644 --- a/crates/nu-cli/tests/commands/cd.rs +++ b/crates/nu-cli/tests/commands/cd.rs @@ -432,3 +432,27 @@ fn valuesystem_path_not_found() { assert!(actual.err.contains("No such path exists")); }) } + +#[cfg(target_os = "windows")] +#[test] +fn test_change_windows_drive() { + Playground::setup("cd_test_20", |dirs, sandbox| { + sandbox.mkdir("test_folder"); + + let _actual = nu!( + cwd: dirs.test(), + r#" + subst Z: test_folder + Z: + echo "some text" | save test_file.txt + cd ~ + subst Z: /d + "# + ); + assert!(dirs + .test() + .join("test_folder") + .join("test_file.txt") + .exists()); + }) +}