1#![cfg(feature = "cargo")]
2
3use clap::{command, error::ErrorKind};
4
5use crate::utils;
6
7static EVERYTHING: &str = "clap {{version}}
8A simple to use, efficient, and full-featured Command Line Argument Parser
9
10Usage: clap
11
12Options:
13  -h, --help     Print help
14  -V, --version  Print version
15";
16
17#[test]
18fn command() {
19    let res = command!()
20        .help_template(utils::FULL_TEMPLATE)
21        .try_get_matches_from(vec!["clap", "--help"]);
22
23    assert!(res.is_err());
24    let err = res.unwrap_err();
25    assert_eq!(err.kind(), ErrorKind::DisplayHelp);
26    assert_eq!(
27        err.to_string(),
28        EVERYTHING.replace("{{version}}", env!("CARGO_PKG_VERSION"))
29    );
30}
31