File: explicit_name_no_renaming.rs

package info (click to toggle)
rust-structopt 0.3.26-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 796 kB
  • sloc: makefile: 2
file content (32 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
mod utils;

use structopt::StructOpt;
use utils::*;

#[test]
fn explicit_short_long_no_rename() {
    #[derive(StructOpt, PartialEq, Debug)]
    struct Opt {
        #[structopt(short = ".", long = ".foo")]
        foo: Vec<String>,
    }

    assert_eq!(
        Opt {
            foo: vec!["short".into(), "long".into()]
        },
        Opt::from_iter(&["test", "-.", "short", "--.foo", "long"])
    );
}

#[test]
fn explicit_name_no_rename() {
    #[derive(StructOpt, PartialEq, Debug)]
    struct Opt {
        #[structopt(name = ".options")]
        foo: Vec<String>,
    }

    let help = get_long_help::<Opt>();
    assert!(help.contains("[.options]..."))
}