Make test_change_working_directory change the current

directory to be the parent of the current-current directory,
instead of changing to the tmp directory, which was causing
issues with OS X and its /tmp => /private/tmp symlink.
This commit is contained in:
gareth 2013-05-14 20:10:14 +01:00
parent 76c31217be
commit 49a1ab8745

View File

@ -1108,13 +1108,15 @@ mod tests {
#[test]
fn test_change_working_directory() {
let tmp_path = os::tmpdir().normalize();
let mut prog = run_pwd(Some(&tmp_path));
// test changing to the parent of os::getcwd() because we know
// the path exists (and os::getcwd() is not expected to be root)
let parent_path = os::getcwd().dir_path().normalize();
let mut prog = run_pwd(Some(&parent_path));
let output = str::from_bytes(prog.finish_with_output().output);
let child_dir = Path(output.trim()).normalize();
assert_eq!(child_dir.to_str(), tmp_path.to_str());
assert_eq!(child_dir.to_str(), parent_path.to_str());
}
#[cfg(unix)]