summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/tests/termios
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/tests/termios')
-rw-r--r--vendor/rustix/tests/termios/isatty.rs69
-rw-r--r--vendor/rustix/tests/termios/main.rs10
-rw-r--r--vendor/rustix/tests/termios/ttyname.rs24
3 files changed, 0 insertions, 103 deletions
diff --git a/vendor/rustix/tests/termios/isatty.rs b/vendor/rustix/tests/termios/isatty.rs
deleted file mode 100644
index 5e6fae73d..000000000
--- a/vendor/rustix/tests/termios/isatty.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-use rustix::fd::AsRawFd;
-use rustix::termios::{isatty, tcgetwinsize};
-use tempfile::{tempdir, TempDir};
-
-#[allow(unused)]
-fn tmpdir() -> TempDir {
- tempdir().expect("expected to be able to create a temporary directory")
-}
-
-#[test]
-fn std_file_is_not_terminal() {
- let tmpdir = tempfile::tempdir().unwrap();
- assert!(!isatty(
- &std::fs::File::create(tmpdir.path().join("file")).unwrap()
- ));
- assert!(!isatty(
- &std::fs::File::open(tmpdir.path().join("file")).unwrap()
- ));
-}
-
-#[test]
-fn stdout_stderr_terminals() {
- // This test is flaky under qemu.
- if std::env::vars().any(|var| var.0.starts_with("CARGO_TARGET_") && var.0.ends_with("_RUNNER"))
- {
- return;
- }
-
- // Compare `isatty` against `libc::isatty`.
- assert_eq!(isatty(&std::io::stdout()), unsafe {
- libc::isatty(std::io::stdout().as_raw_fd()) != 0
- });
- assert_eq!(isatty(&std::io::stderr()), unsafe {
- libc::isatty(std::io::stderr().as_raw_fd()) != 0
- });
-
- // Compare `isatty` against `tcgetwinsize`.
- assert_eq!(
- isatty(&std::io::stdout()),
- tcgetwinsize(&std::io::stdout()).is_ok()
- );
- assert_eq!(
- isatty(&std::io::stderr()),
- tcgetwinsize(&std::io::stderr()).is_ok()
- );
-}
-
-#[test]
-fn stdio_descriptors() {
- #[cfg(unix)]
- use std::os::unix::io::AsRawFd;
- #[cfg(target_os = "wasi")]
- use std::os::wasi::io::AsRawFd;
-
- unsafe {
- assert_eq!(
- rustix::io::stdin().as_raw_fd(),
- std::io::stdin().as_raw_fd()
- );
- assert_eq!(
- rustix::io::stdout().as_raw_fd(),
- std::io::stdout().as_raw_fd()
- );
- assert_eq!(
- rustix::io::stderr().as_raw_fd(),
- std::io::stderr().as_raw_fd()
- );
- }
-}
diff --git a/vendor/rustix/tests/termios/main.rs b/vendor/rustix/tests/termios/main.rs
deleted file mode 100644
index d9ad9338b..000000000
--- a/vendor/rustix/tests/termios/main.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//! Tests for [`rustix::termios`].
-
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg(feature = "termios")]
-
-#[cfg(not(windows))]
-mod isatty;
-#[cfg(not(windows))]
-mod ttyname;
diff --git a/vendor/rustix/tests/termios/ttyname.rs b/vendor/rustix/tests/termios/ttyname.rs
deleted file mode 100644
index 636178c31..000000000
--- a/vendor/rustix/tests/termios/ttyname.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use rustix::io;
-use rustix::termios::{isatty, ttyname};
-use std::fs::File;
-
-#[test]
-fn test_ttyname_ok() {
- let file = File::open("/dev/stdin").unwrap();
- if isatty(&file) {
- assert!(ttyname(&file, Vec::new())
- .unwrap()
- .into_string()
- .unwrap()
- .starts_with("/dev/"));
- }
-}
-
-#[test]
-fn test_ttyname_not_tty() {
- let file = File::open("Cargo.toml").unwrap();
- assert_eq!(ttyname(&file, Vec::new()).unwrap_err(), io::Errno::NOTTY);
-
- let file = File::open("/dev/null").unwrap();
- assert_eq!(ttyname(&file, Vec::new()).unwrap_err(), io::Errno::NOTTY);
-}