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 clap::Parser;
10
11 #[test]
raw_bool_literal()12 fn raw_bool_literal() {
13 #[derive(Parser, Debug, PartialEq)]
14 #[command(name = "raw_bool")]
15 struct Opt {
16 #[arg(raw(false))]
17 a: String,
18 #[arg(raw(true))]
19 b: String,
20 }
21
22 assert_eq!(
23 Opt {
24 a: "one".into(),
25 b: "--help".into()
26 },
27 Opt::try_parse_from(["test", "one", "--", "--help"]).unwrap()
28 );
29 }
30