2980: test: Easier to test with minimal features r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
This commit is contained in:
bors[bot] 2021-11-02 22:02:31 +00:00 committed by GitHub
commit acaa3645c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View file

@ -39,7 +39,7 @@ heck = "0.3.0"
proc-macro-error = "1" proc-macro-error = "1"
[dev-dependencies] [dev-dependencies]
clap = { path = "../" } clap = { path = "../", default-features = false, features = ["std", "derive", "env"] }
trybuild = "1.0" trybuild = "1.0"
rustversion = "1" rustversion = "1"
version-sync = "0.9" version-sync = "0.9"

View file

@ -1,4 +1,4 @@
use clap::{AppSettings, Args, ColorChoice, IntoApp, Parser, Subcommand}; use clap::{AppSettings, Args, IntoApp, Parser, Subcommand};
#[test] #[test]
fn arg_help_heading_applied() { fn arg_help_heading_applied() {
@ -191,7 +191,7 @@ fn flatten_field_with_help_heading() {
#[test] #[test]
fn derive_generated_error_has_full_context() { fn derive_generated_error_has_full_context() {
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(setting(AppSettings::SubcommandsNegateReqs), color = ColorChoice::Never)] #[clap(setting(AppSettings::SubcommandsNegateReqs))]
struct Opts { struct Opts {
#[clap(long)] #[clap(long)]
req_str: String, req_str: String,

View file

@ -1,6 +1,6 @@
mod utils; mod utils;
use clap::{App, Arg, ColorChoice, Error, ErrorKind}; use clap::{App, Arg, Error, ErrorKind};
fn compare_error( fn compare_error(
err: Error, err: Error,
@ -52,8 +52,6 @@ For more information try --help
.long("no-git-push") .long("no-git-push")
.about("Do not push generated commit and tags to git remote"), .about("Do not push generated commit and tags to git remote"),
); );
#[cfg(feature = "color")]
let app = app.color(ColorChoice::Never);
let mut app = app; let mut app = app;
let expected_kind = ErrorKind::InvalidValue; let expected_kind = ErrorKind::InvalidValue;
let err = app.error(expected_kind, "Failed for mysterious reasons"); let err = app.error(expected_kind, "Failed for mysterious reasons");