From 8368d4f2b44ae1441390a2f7eee48af340c8d70c Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Fri, 11 Oct 2019 02:35:50 -0500 Subject: [PATCH] Add comments to explain the chdir test --- tests/run-pass/{change_current_dir.rs => current_dir.rs} | 3 +++ 1 file changed, 3 insertions(+) rename tests/run-pass/{change_current_dir.rs => current_dir.rs} (66%) diff --git a/tests/run-pass/change_current_dir.rs b/tests/run-pass/current_dir.rs similarity index 66% rename from tests/run-pass/change_current_dir.rs rename to tests/run-pass/current_dir.rs index fa8220339db0..48045187ab15 100644 --- a/tests/run-pass/change_current_dir.rs +++ b/tests/run-pass/current_dir.rs @@ -6,6 +6,9 @@ fn main() { // test that `getcwd` is available let cwd = env::current_dir().unwrap(); + // test that changing dir to `..` actually sets the current directory to the parent of `cwd`. + // the only exception here is if `cwd` is the root directory, then changing directory must + // keep the current directory equal to `cwd`. let parent = cwd.parent().unwrap_or(&cwd); // test that `chdir` is available assert!(env::set_current_dir(&Path::new("..")).is_ok());