diff options
| author | Ralf Jung <post@ralfj.de> | 2022-10-21 14:16:12 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-10-21 14:22:12 +0200 |
| commit | 1c9f3682f5d95ccb5bd7d9f3e49dd49df5e9ee4e (patch) | |
| tree | d45deb131bb99959c70c058bc3c9dafd4172eac5 | |
| parent | 7300aac798d033df973f595063c77ecd986e6d4e (diff) | |
| download | rust-1c9f3682f5d95ccb5bd7d9f3e49dd49df5e9ee4e.tar.gz rust-1c9f3682f5d95ccb5bd7d9f3e49dd49df5e9ee4e.zip | |
test is_terminal
| -rw-r--r-- | src/tools/miri/tests/pass/shims/fs.rs | 5 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/shims/io.rs | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/tools/miri/tests/pass/shims/fs.rs b/src/tools/miri/tests/pass/shims/fs.rs index 1758e486ac3..65cf6fe66ba 100644 --- a/src/tools/miri/tests/pass/shims/fs.rs +++ b/src/tools/miri/tests/pass/shims/fs.rs @@ -3,6 +3,7 @@ #![feature(io_error_more)] #![feature(io_error_uncategorized)] +#![feature(is_terminal)] use std::collections::HashMap; use std::ffi::OsString; @@ -10,7 +11,7 @@ use std::fs::{ canonicalize, create_dir, read_dir, read_link, remove_dir, remove_dir_all, remove_file, rename, File, OpenOptions, }; -use std::io::{Error, ErrorKind, Read, Result, Seek, SeekFrom, Write}; +use std::io::{Error, ErrorKind, IsTerminal, Read, Result, Seek, SeekFrom, Write}; use std::path::{Path, PathBuf}; fn main() { @@ -91,6 +92,8 @@ fn test_file() { file.read_to_end(&mut contents).unwrap(); assert_eq!(bytes, contents.as_slice()); + assert!(!file.is_terminal()); + // Removing file should succeed. remove_file(&path).unwrap(); } diff --git a/src/tools/miri/tests/pass/shims/io.rs b/src/tools/miri/tests/pass/shims/io.rs new file mode 100644 index 00000000000..4d43549a930 --- /dev/null +++ b/src/tools/miri/tests/pass/shims/io.rs @@ -0,0 +1,9 @@ +#![feature(is_terminal)] + +use std::io::IsTerminal; + +fn main() { + // We can't really assume that this is truly a terminal, and anyway on Windows Miri will always + // return `false` here, but we can check that the call succeeds. + std::io::stdout().is_terminal(); +} |
