test is_terminal
This commit is contained in:
parent
7300aac798
commit
1c9f3682f5
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#![feature(io_error_more)]
|
#![feature(io_error_more)]
|
||||||
#![feature(io_error_uncategorized)]
|
#![feature(io_error_uncategorized)]
|
||||||
|
#![feature(is_terminal)]
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
@ -10,7 +11,7 @@
|
|||||||
canonicalize, create_dir, read_dir, read_link, remove_dir, remove_dir_all, remove_file, rename,
|
canonicalize, create_dir, read_dir, read_link, remove_dir, remove_dir_all, remove_file, rename,
|
||||||
File, OpenOptions,
|
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};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -91,6 +92,8 @@ fn test_file() {
|
|||||||
file.read_to_end(&mut contents).unwrap();
|
file.read_to_end(&mut contents).unwrap();
|
||||||
assert_eq!(bytes, contents.as_slice());
|
assert_eq!(bytes, contents.as_slice());
|
||||||
|
|
||||||
|
assert!(!file.is_terminal());
|
||||||
|
|
||||||
// Removing file should succeed.
|
// Removing file should succeed.
|
||||||
remove_file(&path).unwrap();
|
remove_file(&path).unwrap();
|
||||||
}
|
}
|
||||||
|
9
src/tools/miri/tests/pass/shims/io.rs
Normal file
9
src/tools/miri/tests/pass/shims/io.rs
Normal file
@ -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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user