Skip to content

Conversation

prataprc
Copy link
Contributor

I am looking at issues to get a hang of rust lang and its ecosystem. If this commit does not make sense, please feel free to abandon. Thanks,

At later point, if opt_present() decide to return gracefully with
false, instead of panic, we can just remove #[should_panic] attribute
on the test case.
@KodrAus
Copy link
Contributor

KodrAus commented May 23, 2018

Thanks for the pull request @prataprc! This looks like a great start, I think we could refactor the test just a bit so it only hits the panic we expect when calling matches.opt_present:

match opts.parse(args) {
    Ok(matches) => assert!(!matches.opt_present("undefined")),
    Err(e) => println!("failed to parse opts: {}", e),
}

So that way if we fail to parse the args (even though we won't, and if we do then other tests should fail) we won't pass this one because there won't be any panic.

@prataprc
Copy link
Contributor Author

Suggestion looks neat ! Amended the PR.

@KodrAus
Copy link
Contributor

KodrAus commented May 27, 2018

This looks good to me! Thanks @prataprc

@KodrAus KodrAus merged commit 08af2e5 into rust-lang:master May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants