Skip to content

Commit 8368d4f

Browse files
committed
Add comments to explain the chdir test
1 parent c8df017 commit 8368d4f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/run-pass/change_current_dir.rs renamed to tests/run-pass/current_dir.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ use std::path::Path;
66
fn main() {
77
// test that `getcwd` is available
88
let cwd = env::current_dir().unwrap();
9+
// test that changing dir to `..` actually sets the current directory to the parent of `cwd`.
10+
// the only exception here is if `cwd` is the root directory, then changing directory must
11+
// keep the current directory equal to `cwd`.
912
let parent = cwd.parent().unwrap_or(&cwd);
1013
// test that `chdir` is available
1114
assert!(env::set_current_dir(&Path::new("..")).is_ok());

0 commit comments

Comments
 (0)