rust/tests/ui/suspicious_command_arg_space.rs

15 lines
747 B
Rust
Raw Normal View History

2023-09-10 09:14:20 -05:00
#![allow(clippy::zombie_processes)]
2023-02-10 10:13:30 -06:00
fn main() {
// Things it should warn about:
2023-02-10 10:13:30 -06:00
std::process::Command::new("echo").arg("-n hello").spawn().unwrap();
//~^ ERROR: single argument that looks like it should be multiple arguments
//~| NOTE: `-D clippy::suspicious-command-arg-space` implied by `-D warnings`
2023-02-10 10:13:30 -06:00
std::process::Command::new("cat").arg("--number file").spawn().unwrap();
//~^ ERROR: single argument that looks like it should be multiple arguments
// Things it should not warn about:
std::process::Command::new("echo").arg("hello world").spawn().unwrap();
std::process::Command::new("a").arg("--fmt=%a %b %c").spawn().unwrap();
std::process::Command::new("b").arg("-ldflags=-s -w").spawn().unwrap();
2023-02-10 10:13:30 -06:00
}