Skip to content

Commit 3c6274a

Browse files
committed
test is_terminal
1 parent d6074e0 commit 3c6274a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tests/pass/shims/fs.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33

44
#![feature(io_error_more)]
55
#![feature(io_error_uncategorized)]
6+
#![feature(is_terminal)]
67

78
use std::collections::HashMap;
89
use std::ffi::OsString;
910
use std::fs::{
1011
canonicalize, create_dir, read_dir, read_link, remove_dir, remove_dir_all, remove_file, rename,
1112
File, OpenOptions,
1213
};
13-
use std::io::{Error, ErrorKind, Read, Result, Seek, SeekFrom, Write};
14+
use std::io::{Error, ErrorKind, IsTerminal, Read, Result, Seek, SeekFrom, Write};
1415
use std::path::{Path, PathBuf};
1516

1617
fn main() {
@@ -91,6 +92,8 @@ fn test_file() {
9192
file.read_to_end(&mut contents).unwrap();
9293
assert_eq!(bytes, contents.as_slice());
9394

95+
assert!(!file.is_terminal());
96+
9497
// Removing file should succeed.
9598
remove_file(&path).unwrap();
9699
}

tests/pass/shims/io.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(is_terminal)]
2+
3+
use std::io::IsTerminal;
4+
5+
fn main() {
6+
// We can't really assume that this is truly a terminal, and anyway on Windows Miri will always
7+
// return `false` here, but we can check that the call succeeds.
8+
std::io::stdout().is_terminal();
9+
}

0 commit comments

Comments
 (0)