mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
test(usage): Make cases more consistent
Besides being more explicit / clear, this makes it easier to experiment with tweaking the logic and keeping the test updates minimal, so the change of behavior stands out more.
This commit is contained in:
parent
b42e2baf59
commit
92df0ba263
1 changed files with 80 additions and 93 deletions
|
@ -431,6 +431,7 @@ mod test {
|
||||||
assert!(a.long.is_none());
|
assert!(a.long.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -472,6 +473,7 @@ mod test {
|
||||||
assert!(a.long.is_none());
|
assert!(a.long.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -569,6 +571,7 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -610,6 +613,7 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -622,9 +626,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -637,9 +640,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -652,9 +654,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -667,9 +668,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -682,9 +682,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -697,9 +696,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -713,6 +711,7 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -725,9 +724,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -740,9 +738,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -756,6 +753,7 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -768,9 +766,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -783,9 +780,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -798,9 +794,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -813,9 +808,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -828,9 +822,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -844,6 +837,7 @@ mod test {
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -856,9 +850,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -872,6 +865,7 @@ mod test {
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -884,9 +878,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -899,9 +892,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -914,9 +906,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -929,9 +920,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -944,9 +934,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -960,6 +949,7 @@ mod test {
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -972,9 +962,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -988,6 +977,7 @@ mod test {
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"opt"]);
|
||||||
|
@ -1000,9 +990,8 @@ mod test {
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"option"]);
|
||||||
|
@ -1015,9 +1004,8 @@ mod test {
|
||||||
assert!(a.long.is_none());
|
assert!(a.long.is_none());
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
||||||
|
@ -1030,9 +1018,8 @@ mod test {
|
||||||
assert!(a.long.is_none());
|
assert!(a.long.is_none());
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
||||||
|
@ -1045,9 +1032,8 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
||||||
|
@ -1060,9 +1046,8 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
||||||
|
@ -1075,9 +1060,8 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
}
|
}
|
||||||
|
@ -1087,9 +1071,8 @@ mod test {
|
||||||
let a = Arg::from("[pos] 'some help info'");
|
let a = Arg::from("[pos] 'some help info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
}
|
}
|
||||||
|
@ -1099,9 +1082,8 @@ mod test {
|
||||||
let a = Arg::from("<pos> 'some help info'");
|
let a = Arg::from("<pos> 'some help info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
}
|
}
|
||||||
|
@ -1111,6 +1093,7 @@ mod test {
|
||||||
let a = Arg::from("[pos]... 'some help info'");
|
let a = Arg::from("[pos]... 'some help info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1121,6 +1104,7 @@ mod test {
|
||||||
let a = Arg::from("[pos]... 'some help\' info'");
|
let a = Arg::from("[pos]... 'some help\' info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help' info");
|
assert_eq!(a.about.unwrap(), "some help' info");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1131,6 +1115,7 @@ mod test {
|
||||||
let a = Arg::from("[pos]... 'some \'help\' info'");
|
let a = Arg::from("[pos]... 'some \'help\' info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some 'help' info");
|
assert_eq!(a.about.unwrap(), "some 'help' info");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1144,6 +1129,7 @@ mod test {
|
||||||
);
|
);
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help\ninfo");
|
assert_eq!(a.about.unwrap(), "some help\ninfo");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1157,6 +1143,7 @@ mod test {
|
||||||
);
|
);
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help' stuff\ninfo");
|
assert_eq!(a.about.unwrap(), "some help' stuff\ninfo");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1167,6 +1154,7 @@ mod test {
|
||||||
let a = Arg::from("<pos>... 'some help info'");
|
let a = Arg::from("<pos>... 'some help info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1176,9 +1164,8 @@ mod test {
|
||||||
fn pos_req() {
|
fn pos_req() {
|
||||||
let a = Arg::from("<pos>");
|
let a = Arg::from("<pos>");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
}
|
}
|
||||||
|
@ -1187,6 +1174,7 @@ mod test {
|
||||||
fn pos_mult() {
|
fn pos_mult() {
|
||||||
let a = Arg::from("[pos]...");
|
let a = Arg::from("[pos]...");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1197,6 +1185,7 @@ mod test {
|
||||||
let a = Arg::from("<pos>... @a 'some help info'");
|
let a = Arg::from("<pos>... @a 'some help info'");
|
||||||
assert_eq!(a.name, "pos");
|
assert_eq!(a.name, "pos");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
assert!(a.is_set(ArgSettings::MultipleValues));
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert!(a.val_names.is_empty());
|
assert!(a.val_names.is_empty());
|
||||||
|
@ -1210,9 +1199,8 @@ mod test {
|
||||||
assert!(a.long.is_none());
|
assert!(a.long.is_none());
|
||||||
assert_eq!(a.short.unwrap(), 'o');
|
assert_eq!(a.short.unwrap(), 'o');
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(a.is_set(ArgSettings::Required));
|
assert!(a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
||||||
|
@ -1226,9 +1214,8 @@ mod test {
|
||||||
assert!(a.short.is_none());
|
assert!(a.short.is_none());
|
||||||
assert_eq!(a.long.unwrap(), "opt");
|
assert_eq!(a.long.unwrap(), "opt");
|
||||||
assert_eq!(a.about.unwrap(), "some help info");
|
assert_eq!(a.about.unwrap(), "some help info");
|
||||||
assert!(
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
||||||
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
||||||
);
|
|
||||||
assert!(a.is_set(ArgSettings::TakesValue));
|
assert!(a.is_set(ArgSettings::TakesValue));
|
||||||
assert!(!a.is_set(ArgSettings::Required));
|
assert!(!a.is_set(ArgSettings::Required));
|
||||||
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
assert_eq!(a.val_names.iter().collect::<Vec<_>>(), [&"file", &"mode"]);
|
||||||
|
|
Loading…
Reference in a new issue