Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/process/working_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ fn test_changing_working_directory() {
let tmpdir = tmpdir();

let orig_cwd = rustix::process::getcwd(Vec::new()).expect("get the cwd");
assert!(orig_cwd.to_str().unwrap().starts_with("/"));

assert_eq!(
orig_cwd.to_str().unwrap(),
std::env::current_dir().unwrap().display().to_string(),
"rustix's cwd doesn't match std's"
);

#[cfg(not(target_os = "fuchsia"))]
let orig_fd_cwd = rustix::fs::openat(rustix::fs::CWD, ".", OFlags::RDONLY, Mode::empty())
Expand Down
11 changes: 7 additions & 4 deletions tests/termios/ttyname.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustix::fs::FileTypeExt;
use rustix::io;
use rustix::termios::{isatty, ttyname};
use std::fs::File;
Expand All @@ -10,11 +11,13 @@ fn test_ttyname_ok() {
Err(err) => Err(err).unwrap(),
};
if isatty(&file) {
assert!(ttyname(&file, Vec::new())
let name = ttyname(&file, Vec::new()).unwrap().into_string().unwrap();
assert!(name.starts_with("/dev/"));
assert!(!name.ends_with("/"));
assert!(std::fs::metadata(&name)
.unwrap()
.into_string()
.unwrap()
.starts_with("/dev/"));
.file_type()
.is_char_device());
}
}

Expand Down