diff --git a/tests/builder/conflicts.rs b/tests/builder/conflicts.rs index d623f8c9508..77f9d5cae17 100644 --- a/tests/builder/conflicts.rs +++ b/tests/builder/conflicts.rs @@ -704,6 +704,26 @@ For more information, try '--help'. utils::assert_output(cmd, "test --place id sub1", CONFLICT_ERR, true); } +#[test] +#[cfg(feature = "error-context")] +fn positional_conflicts_with_subcommand() { + static CONFLICT_ERR: &str = "\ +error: unexpected argument 'sub1' found + +Usage: test + test + +For more information, try '--help'. +"; + + let cmd = Command::new("test") + .args_conflicts_with_subcommands(true) + .arg(arg!( "some arg")) + .subcommand(Command::new("sub1")); + + utils::assert_output(cmd, "test value1 sub1", CONFLICT_ERR, true); +} + #[test] fn subcommand_conflict_negates_required() { let cmd = Command::new("test")