-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test-programs: cover both when stdio isatty and not
prtest:full
- Loading branch information
Pat Hickey
committed
Aug 14, 2023
1 parent
f9d4be7
commit 0e59b26
Showing
7 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
crates/test-programs/wasi-tests/src/bin/stdio_not_isatty.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::{env, process}; | ||
use wasi_tests::open_scratch_directory; | ||
|
||
unsafe fn test_stdio_not_isatty() { | ||
assert_eq!( | ||
libc::isatty(libc::STDIN_FILENO as std::os::raw::c_int), | ||
0, | ||
"stdin is not a tty" | ||
); | ||
assert_eq!( | ||
libc::isatty(libc::STDOUT_FILENO as std::os::raw::c_int), | ||
0, | ||
"stdout is not a tty" | ||
); | ||
assert_eq!( | ||
libc::isatty(libc::STDERR_FILENO as std::os::raw::c_int), | ||
0, | ||
"stderr is not a tty" | ||
); | ||
} | ||
|
||
fn main() { | ||
// Run the tests. | ||
unsafe { test_stdio_not_isatty() } | ||
} |