summaryrefslogtreecommitdiffstats
path: root/vendor/xflags-macros/tests/it/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/xflags-macros/tests/it/main.rs')
-rw-r--r--vendor/xflags-macros/tests/it/main.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/vendor/xflags-macros/tests/it/main.rs b/vendor/xflags-macros/tests/it/main.rs
index 1ce058814..7d77bda36 100644
--- a/vendor/xflags-macros/tests/it/main.rs
+++ b/vendor/xflags-macros/tests/it/main.rs
@@ -67,9 +67,10 @@ fn smoke() {
"-n 92 --werbose",
expect![[r#"unexpected flag: `--werbose`"#]],
);
- check(smoke::RustAnalyzer::from_vec, "", expect![[r#"flag is required: `workspace`"#]]);
+ check(smoke::RustAnalyzer::from_vec, "", expect!["flag is required: `--number`"]);
check(smoke::RustAnalyzer::from_vec, ".", expect![[r#"flag is required: `--number`"#]]);
check(smoke::RustAnalyzer::from_vec, "-n", expect![[r#"expected a value for `-n`"#]]);
+ check(smoke::RustAnalyzer::from_vec, "-n 92", expect!["flag is required: `workspace`"]);
check(
smoke::RustAnalyzer::from_vec,
"-n lol",
@@ -196,3 +197,36 @@ fn subcommands() {
check(subcommands::RustAnalyzer::from_vec, "", expect![[r#"subcommand is required"#]]);
}
+
+#[test]
+fn subcommand_flag_inheritance() {
+ check(
+ subcommands::RustAnalyzer::from_vec,
+ "server watch --verbose --dir .",
+ expect![[r#"
+ RustAnalyzer {
+ verbose: 1,
+ subcommand: Server(
+ Server {
+ dir: Some(
+ ".",
+ ),
+ subcommand: Watch(
+ Watch,
+ ),
+ },
+ ),
+ }
+ "#]],
+ );
+ check(
+ subcommands::RustAnalyzer::from_vec,
+ "analysis-stats --verbose --dir .",
+ expect!["unexpected flag: `--dir`"],
+ );
+ check(
+ subcommands::RustAnalyzer::from_vec,
+ "--dir . server",
+ expect!["unexpected flag: `--dir`"],
+ );
+}