mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
tests: updates tests to account for variable term widths and non-english chars
This commit is contained in:
parent
d0b442c7be
commit
cdb9037c15
1 changed files with 39 additions and 16 deletions
|
@ -93,12 +93,13 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café is an
|
||||
establishment which primarily serves hot
|
||||
coffee, related coffee beverages (e.g., café
|
||||
latte, cappuccino, espresso), tea, and other
|
||||
hot beverages. Some coffeehouses also serve cold
|
||||
beverages such as iced coffee and iced tea. Many
|
||||
cafés also serve some type of food, such as light
|
||||
snacks, muffins, or pastries.";
|
||||
coffee, related coffee beverages (e.g.,
|
||||
café latte, cappuccino, espresso), tea,
|
||||
and other hot beverages. Some
|
||||
coffeehouses also serve cold beverages
|
||||
such as iced coffee and iced tea. Many
|
||||
cafés also serve some type of food, such
|
||||
as light snacks, muffins, or pastries.";
|
||||
|
||||
static ISSUE_626_PANIC: &'static str = "ctest 0.1
|
||||
|
||||
|
@ -110,15 +111,19 @@ FLAGS:
|
|||
-V, --version Prints version information
|
||||
|
||||
OPTIONS:
|
||||
-c, --cafe <FILE> La culture du café est très
|
||||
développée dans de
|
||||
nombreux pays à climat chaud
|
||||
d'Amérique, d'Afrique et
|
||||
d'Asie, dans des plantations qui
|
||||
sont cultivées pour les marchés
|
||||
d'exportation. Le café est souvent
|
||||
une contribution majeure aux
|
||||
exportations des régions productrices.";
|
||||
-c, --cafe <FILE> La culture du café est
|
||||
très développée dans de
|
||||
nombreux pays à climat
|
||||
chaud d'Amérique,
|
||||
d'Afrique et d'Asie,
|
||||
dans des plantations
|
||||
qui sont cultivées pour
|
||||
les marchés
|
||||
d'exportation. Le café
|
||||
est souvent une
|
||||
contribution majeure
|
||||
aux exportations des
|
||||
régions productrices.";
|
||||
|
||||
#[test]
|
||||
fn help_short() {
|
||||
|
@ -271,7 +276,7 @@ fn issue_626_unicode_cutoff() {
|
|||
fn issue_626_panic() {
|
||||
let app = App::new("ctest")
|
||||
.version("0.1")
|
||||
.set_term_width(53)
|
||||
.set_term_width(52)
|
||||
.arg(Arg::with_name("cafe")
|
||||
.short("c")
|
||||
.long("cafe")
|
||||
|
@ -282,3 +287,21 @@ fn issue_626_panic() {
|
|||
.takes_value(true));
|
||||
test::check_err_output(app, "ctest --help", ISSUE_626_PANIC, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_626_variable_panic() {
|
||||
for i in 10..320 {
|
||||
let _ = App::new("ctest")
|
||||
.version("0.1")
|
||||
.set_term_width(i)
|
||||
.arg(Arg::with_name("cafe")
|
||||
.short("c")
|
||||
.long("cafe")
|
||||
.value_name("FILE")
|
||||
.help("La culture du café est très développée dans de nombreux pays à climat chaud d'Amérique, \
|
||||
d'Afrique et d'Asie, dans des plantations qui sont cultivées pour les marchés d'exportation. \
|
||||
Le café est souvent une contribution majeure aux exportations des régions productrices.")
|
||||
.takes_value(true))
|
||||
.get_matches_from_safe(vec!["ctest", "--help"]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue