diff --git a/tests/process/working_directory.rs b/tests/process/working_directory.rs index a9e5706ce..2b4f4e244 100644 --- a/tests/process/working_directory.rs +++ b/tests/process/working_directory.rs @@ -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()) diff --git a/tests/termios/ttyname.rs b/tests/termios/ttyname.rs index b3f8d4843..e9a977775 100644 --- a/tests/termios/ttyname.rs +++ b/tests/termios/ttyname.rs @@ -1,3 +1,4 @@ +use rustix::fs::FileTypeExt; use rustix::io; use rustix::termios::{isatty, ttyname}; use std::fs::File; @@ -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()); } }