mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 06:12:40 +00:00
test: Consolidate builder tests
This is prep for moving the derive tests. Besides organizing the test folder for each API, this should reduce link time at the cost of re-compiling more when a test changes.
This commit is contained in:
parent
2288f55cc1
commit
045bf99ae0
49 changed files with 70 additions and 61 deletions
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, AppSettings, Arg, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, Arg};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, Arg};
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
mod utils;
|
||||
|
||||
use clap::{Arg, ArgSettings};
|
||||
|
||||
#[test]
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, Arg, ArgGroup, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
use clap::{arg, App, Arg, ErrorKind};
|
||||
|
||||
#[test]
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use std::str;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::App;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{App, Arg, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{App, Arg, Error, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, AppSettings, Arg, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
use clap::{arg, App, Arg};
|
||||
|
||||
const USE_FLAG_AS_ARGUMENT: &str =
|
|
@ -1,5 +1,3 @@
|
|||
mod utils;
|
||||
|
||||
use clap::{arg, App, Arg};
|
||||
|
||||
#[test]
|
|
@ -1,7 +1,5 @@
|
|||
#![cfg(feature = "unstable-grouped")]
|
||||
|
||||
mod utils;
|
||||
|
||||
use clap::{App, AppSettings, Arg};
|
||||
|
||||
#[test]
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, Arg, ArgGroup, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, AppSettings, Arg, ArgGroup, ErrorKind, PossibleValue};
|
||||
|
|
@ -4,7 +4,7 @@ use std::env;
|
|||
|
||||
use clap::{App, Arg};
|
||||
|
||||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
static HIDE_ENV: &str = "ctest 0.1
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, AppSettings, Arg};
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
mod utils;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
#[test]
|
47
tests/builder/main.rs
Normal file
47
tests/builder/main.rs
Normal file
|
@ -0,0 +1,47 @@
|
|||
mod app_from_crate;
|
||||
mod app_settings;
|
||||
mod arg_aliases;
|
||||
mod arg_aliases_short;
|
||||
mod arg_matcher_assertions;
|
||||
mod arg_settings;
|
||||
mod borrowed;
|
||||
mod cargo;
|
||||
mod conflicts;
|
||||
mod default_missing_vals;
|
||||
mod default_vals;
|
||||
mod delimiters;
|
||||
mod derive_order;
|
||||
mod display_order;
|
||||
mod double_require;
|
||||
mod empty_values;
|
||||
mod env;
|
||||
mod error;
|
||||
mod flag_subcommands;
|
||||
mod flags;
|
||||
mod global_args;
|
||||
mod grouped_values;
|
||||
mod groups;
|
||||
mod help;
|
||||
mod help_env;
|
||||
mod hidden_args;
|
||||
mod ignore_errors;
|
||||
mod indices;
|
||||
mod multiple_occurrences;
|
||||
mod multiple_values;
|
||||
mod opts;
|
||||
mod positionals;
|
||||
mod posix_compatible;
|
||||
mod possible_values;
|
||||
mod propagate_globals;
|
||||
mod regex;
|
||||
mod require;
|
||||
mod subcommands;
|
||||
mod template_help;
|
||||
mod tests;
|
||||
mod unicode;
|
||||
mod unique_args;
|
||||
mod utf16;
|
||||
mod utf8;
|
||||
mod utils;
|
||||
mod validators;
|
||||
mod version;
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, AppSettings, Arg, ArgMatches, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{App, Arg, ErrorKind, PossibleValue};
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
mod utils;
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
|
||||
fn get_app() -> App<'static> {
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, Arg, ArgGroup, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App, AppSettings, Arg, ErrorKind};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use clap::{arg, App};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use std::io::Write;
|
||||
use std::str;
|
|
@ -1,4 +1,4 @@
|
|||
mod utils;
|
||||
use crate::utils;
|
||||
|
||||
use std::str;
|
||||
|
|
@ -1,28 +1,7 @@
|
|||
mod utils;
|
||||
|
||||
// We intentionally don't import `clap_app!` here; not having it in scope protects against the
|
||||
// class of errors where the macro refers to itself as `clap_app!` instead of `$crate::clap_app!`
|
||||
use clap::ErrorKind;
|
||||
|
||||
static LITERALS: &str = "clap-tests 0.1
|
||||
|
||||
USAGE:
|
||||
clap-tests [OPTIONS] [SUBCOMMAND]
|
||||
|
||||
OPTIONS:
|
||||
-4, --4 Sets priority to 4
|
||||
-5, --5 Sets priority to 5
|
||||
-6, --6 Sets priority to 6
|
||||
-h, --help Print help information
|
||||
-t, --task-num <task-num> Task number [possible values: all, 0, 1, 2]
|
||||
-V, --version Print version information
|
||||
|
||||
SUBCOMMANDS:
|
||||
0 Set everything to zero priority
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
view-tasks View all tasks
|
||||
";
|
||||
|
||||
#[test]
|
||||
fn basic() {
|
||||
#![allow(deprecated)]
|
||||
|
@ -441,7 +420,7 @@ fn group_macro_multiple_invocations() {
|
|||
#[test]
|
||||
fn literals() {
|
||||
#![allow(deprecated)]
|
||||
let app = clap::clap_app!("clap-tests" =>
|
||||
clap::clap_app!("clap-tests" =>
|
||||
(version: "0.1")
|
||||
(@arg "task-num": -"t-n" --"task-num" +takes_value possible_value["all" 0 1 2]
|
||||
"Task number")
|
||||
|
@ -455,13 +434,6 @@ fn literals() {
|
|||
(@subcommand 0 =>
|
||||
(about: "Set everything to zero priority"))
|
||||
);
|
||||
|
||||
assert!(utils::compare_output(
|
||||
app,
|
||||
"clap-tests --help",
|
||||
LITERALS,
|
||||
false
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue