rust/tests/ui/command/command-argv0.rs
Alex Crichton cf6d6050f7 Update test directives for wasm32-wasip1
* The WASI targets deal with the `main` symbol a bit differently than
  native so some `codegen` and `assembly` tests have been ignored.
* All `ignore-emscripten` directives have been updated to
  `ignore-wasm32` to be more clear that all wasm targets are ignored and
  it's not just Emscripten.
* Most `ignore-wasm32-bare` directives are now gone.
* Some ignore directives for wasm were switched to `needs-unwind`
  instead.
* Many `ignore-wasm32*` directives are removed as the tests work with
  WASI as opposed to `wasm32-unknown-unknown`.
2024-03-11 09:36:35 -07:00

31 lines
766 B
Rust

//@ run-pass
//@ ignore-windows - this is a unix-specific test
//@ ignore-wasm32 no processes
//@ ignore-sgx no processes
use std::env;
use std::os::unix::process::CommandExt;
use std::process::Command;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() > 1 {
assert_eq!(args[1], "doing-test");
assert_eq!(args[0], "i have a silly name");
println!("passed");
return;
}
let output =
Command::new(&args[0]).arg("doing-test").arg0("i have a silly name").output().unwrap();
assert!(
output.stderr.is_empty(),
"Non-empty stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());
assert_eq!(output.stdout, b"passed\n");
}