docs: fix tests that fail when the "suggestions" feature is disabled

This commit is contained in:
tormol 2016-10-05 20:06:32 +02:00
parent da88fd254b
commit 996fc38176
4 changed files with 14 additions and 1 deletions

View file

@ -55,7 +55,8 @@ pub enum ErrorKind {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature="suggestions"), doc=" ```no_run")]
#[cfg_attr( feature="suggestions" , doc=" ```")]
/// # use clap::{App, Arg, ErrorKind, SubCommand}; /// # use clap::{App, Arg, ErrorKind, SubCommand};
/// let result = App::new("myprog") /// let result = App::new("myprog")
/// .subcommand(SubCommand::with_name("config") /// .subcommand(SubCommand::with_name("config")

View file

@ -226,6 +226,7 @@ fn require_delims() {
} }
#[test] #[test]
#[cfg(feature="suggestions")]
fn did_you_mean() { fn did_you_mean() {
test::check_err_output(test::complex_app(), "clap-test --optio=foo", test::check_err_output(test::complex_app(), "clap-test --optio=foo",
"error: Found argument '--optio' which wasn't expected, or isn't valid in this context "error: Found argument '--optio' which wasn't expected, or isn't valid in this context

View file

@ -5,11 +5,21 @@ include!("../clap-test.rs");
use clap::{App, Arg, ErrorKind}; use clap::{App, Arg, ErrorKind};
#[cfg(feature="suggestions")]
static PV_ERROR: &'static str = "error: 'slo' isn't a valid value for '--Option <option3>' static PV_ERROR: &'static str = "error: 'slo' isn't a valid value for '--Option <option3>'
\t[values: fast, slow] \t[values: fast, slow]
\tDid you mean 'slow'? \tDid you mean 'slow'?
USAGE:
clap-test --Option <option3>
For more information try --help";
#[cfg(not(feature="suggestions"))]
static PV_ERROR: &'static str = "error: 'slo' isn't a valid value for '--Option <option3>'
\t[values: fast, slow]
USAGE: USAGE:
clap-test --Option <option3> clap-test --Option <option3>

View file

@ -107,6 +107,7 @@ fn multiple_aliases() {
} }
#[test] #[test]
#[cfg(feature="suggestions")]
fn subcmd_did_you_mean_output() { fn subcmd_did_you_mean_output() {
test::check_err_output(test::complex_app(), "clap-test subcm", test::check_err_output(test::complex_app(), "clap-test subcm",
"error: The subcommand 'subcm' wasn't recognized "error: The subcommand 'subcm' wasn't recognized