diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /vendor/xflags-macros/tests/it | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-upstream/1.69.0+dfsg1.tar.xz rustc-upstream/1.69.0+dfsg1.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/xflags-macros/tests/it')
-rw-r--r-- | vendor/xflags-macros/tests/it/main.rs | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/vendor/xflags-macros/tests/it/main.rs b/vendor/xflags-macros/tests/it/main.rs index 7d77bda36..bee65b015 100644 --- a/vendor/xflags-macros/tests/it/main.rs +++ b/vendor/xflags-macros/tests/it/main.rs @@ -230,3 +230,73 @@ fn subcommand_flag_inheritance() { expect!["unexpected flag: `--dir`"], ); } + +#[test] +fn edge_cases() { + check( + subcommands::RustAnalyzer::from_vec, + "server --dir --log", + expect![[r#" + RustAnalyzer { + verbose: 0, + subcommand: Server( + Server { + dir: Some( + "--log", + ), + subcommand: Launch( + Launch { + log: false, + }, + ), + }, + ), + } + "#]], + ); + check( + subcommands::RustAnalyzer::from_vec, + "server --dir -- --log", + expect![[r#" + RustAnalyzer { + verbose: 0, + subcommand: Server( + Server { + dir: Some( + "--", + ), + subcommand: Launch( + Launch { + log: true, + }, + ), + }, + ), + } + "#]], + ); + check( + subcommands::RustAnalyzer::from_vec, + "-- -v server", + expect![[r#"unexpected argument: "-v""#]], + ); + check(repeated_pos::RepeatedPos::from_vec, "pos 1 prog -j", expect!["unexpected flag: `-j`"]); + check( + repeated_pos::RepeatedPos::from_vec, + "pos 1 -- prog -j", + expect![[r#" + RepeatedPos { + a: "pos", + b: Some( + 1, + ), + c: Some( + "prog", + ), + rest: [ + "-j", + ], + } + "#]], + ); +} |