// message for `cargo help`
"help" if flags.arg_args[0] == "-h" ||
flags.arg_args[0] == "--help" => {
- vec!["cargo".to_string(), "help".to_string(), "help".to_string()]
+ vec!["cargo".to_string(), "help".to_string(), "-h".to_string()]
}
// For `cargo help foo`, print out the usage message for the specified
// subcommand by executing the command with the `-h` flag.
"help" => {
- vec!["cargo".to_string(), "help".to_string(),
- flags.arg_args[0].clone()]
+ vec!["cargo".to_string(), flags.arg_args[0].clone(),
+ "-h".to_string()]
}
// For all other invocations, we're of the form `cargo foo args...`. We
File::open(&toml).unwrap().read_to_string(&mut contents).unwrap();
assert!(contents.contains(r#"authors = ["foo <bar>"]"#));
});
+
+test!(cargo_help {
+ assert_that(process(&cargo_dir().join("cargo")).unwrap(),
+ execs().with_status(0));
+ assert_that(process(&cargo_dir().join("cargo")).unwrap().arg("help"),
+ execs().with_status(0));
+ assert_that(process(&cargo_dir().join("cargo")).unwrap().arg("-h"),
+ execs().with_status(0));
+ assert_that(process(&cargo_dir().join("cargo")).unwrap()
+ .arg("help").arg("build"),
+ execs().with_status(0));
+ assert_that(process(&cargo_dir().join("cargo")).unwrap()
+ .arg("build").arg("-h"),
+ execs().with_status(0));
+ assert_that(process(&cargo_dir().join("cargo")).unwrap()
+ .arg("help").arg("-h"),
+ execs().with_status(0));
+ assert_that(process(&cargo_dir().join("cargo")).unwrap()
+ .arg("help").arg("help"),
+ execs().with_status(0));
+});