-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run-make: port stdin-rustc to Rust-based rmake.rs
- Loading branch information
Showing
4 changed files
with
26 additions
and
8 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
//! This test checks rustc `-` (stdin) support | ||
|
||
extern crate run_make_support; | ||
|
||
use run_make_support::{rustc, tmp_dir}; | ||
|
||
const HELLO_WORLD: &str = r#" | ||
fn main() { | ||
println!("Hello world!"); | ||
} | ||
"#; | ||
|
||
const NOT_UTF8: &[u8] = &[0xff, 0xff, 0xff]; | ||
|
||
fn main() { | ||
let out_dir = tmp_dir(); | ||
|
||
// echo $HELLO_WORLD | rustc - | ||
rustc().arg("-").stdin(HELLO_WORLD).run(); | ||
assert!(out_dir.join("rust_out").try_exists().unwrap()); | ||
|
||
// echo $NOT_UTF8 | rustc - | ||
let output = rustc().arg("-").stdin(NOT_UTF8).run_fail(); | ||
let stderr = String::from_utf8(output.stderr).unwrap(); | ||
assert!(stderr.contains("error: couldn't read from stdin, as it did not contain valid UTF-8")); | ||
} |