• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>
2 //
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6 // option. This file may not be copied, modified, or distributed
7 // except according to those terms.
8 
9 use structopt::StructOpt;
10 
11 #[test]
raw_bool_literal()12 fn raw_bool_literal() {
13     #[derive(StructOpt, Debug, PartialEq)]
14     #[structopt(no_version, name = "raw_bool")]
15     struct Opt {
16         #[structopt(raw(false))]
17         a: String,
18         #[structopt(raw(true))]
19         b: String,
20     }
21 
22     assert_eq!(
23         Opt {
24             a: "one".into(),
25             b: "--help".into()
26         },
27         Opt::from_iter(&["test", "one", "--", "--help"])
28     );
29 }
30