Skip to content

Commit

Permalink
tests: updated python tests to v2 info
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Jan 28, 2016
1 parent 7be67bf commit da22401
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
8 changes: 4 additions & 4 deletions clap-tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@

_version = "claptests v1.4.8"

_sc_dym_usage = '''error: The subcommand 'subcm' isn't valid
_sc_dym_usage = '''error: The subcommand 'subcm' wasn't recognized
\tDid you mean 'subcmd' ?
If you received this message in error, try re-running with 'claptests -- subcm'
If you believe you received this message in error, try re-running with 'claptests -- subcm'
USAGE:
\tclaptests [FLAGS] [OPTIONS] [ARGS] [SUBCOMMAND]
For more information try --help'''

_arg_dym_usage = '''error: The argument '--optio' isn't valid
_arg_dym_usage = '''error: The argument '--optio' wasn't recognized, or isn't valid
\tDid you mean --option ?
USAGE:
Expand Down Expand Up @@ -83,7 +83,7 @@
For more information try --help'''

_required = '''error: The following required arguments were not supplied:
_required = '''error: The following required arguments were not provided:
\t[positional2]
\t--long-option-2 <option2>
Expand Down
6 changes: 3 additions & 3 deletions clap-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() {
if let Some(v) = matches.value_of("opt") {
println!("option present {} times with value: {}",matches.occurrences_of("opt"), v);
}
if let Some(ref ov) = matches.values_of("opt") {
if let Some(ov) = matches.values_of("opt") {
for o in ov {
println!("An option: {}", o);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ fn main() {
if let Some(v) = matches.value_of("opt") {
println!("option present {} times with value: {}",matches.occurrences_of("opt"), v);
}
if let Some(ref ov) = matches.values_of("opt") {
if let Some(ov) = matches.values_of("opt") {
for o in ov {
println!("An option: {}", o);
}
Expand All @@ -114,7 +114,7 @@ fn main() {
if let Some(v) = matches.value_of("scoption") {
println!("scoption present with value: {}", v);
}
if let Some(ref ov) = matches.values_of("scoption") {
if let Some(ov) = matches.values_of("scoption") {
for o in ov {
println!("An scoption: {}", o);
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,8 @@ impl<'a, 'b> Parser<'a, 'b> where 'a: 'b {
}
}

Err(Error::unknown_argument(arg, &*suffix.0, &*self.create_current_usage(matcher)))
let used_arg = format!("--{}", arg);
Err(Error::unknown_argument(&*used_arg, &*suffix.0, &*self.create_current_usage(matcher)))
}

// Creates a usage string if one was not provided by the user manually. This happens just
Expand Down
13 changes: 9 additions & 4 deletions src/args/arg_matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ impl<'a> ArgMatches<'a> {
# Examples
```no_run
```ignore
# use clap::{App, Arg};
use std::ffi::OsString;
use std::os::unix::ffi::OsStrExt;
let m = App::new("utf8")
.arg(Arg::from_usage("<arg> 'some arg'"))
.get_matches_from(vec![OsString::from("myprog"),
Expand Down Expand Up @@ -167,7 +169,7 @@ impl<'a> ArgMatches<'a> {
# Examples
```no_run
```ignore
# use clap::{App, Arg};
use std::ffi::OsString;
use std::os::unix::ffi::OsStrExt;
Expand Down Expand Up @@ -219,9 +221,11 @@ impl<'a> ArgMatches<'a> {
# Examples
```no_run
```ignore
# use clap::{App, Arg};
use std::ffi::OsString;
use std::os::unix::ffi::OsStrExt;
let m = App::new("utf8")
.arg(Arg::from_usage("<arg> 'some arg'"))
.get_matches_from(vec![OsString::from("myprog"),
Expand Down Expand Up @@ -254,9 +258,10 @@ impl<'a> ArgMatches<'a> {
# Examples
```no_run
```ignore
# use clap::{App, Arg};
use std::ffi::OsString;
use std::os::unix::ffi::OsStrExt;
let m = App::new("utf8")
.arg(Arg::from_usage("<arg> 'some arg'"))
Expand Down

0 comments on commit da22401

Please sign in to comment.