Skip to content

Commit

Permalink
test: error on unknown flag
Browse files Browse the repository at this point in the history
  • Loading branch information
RoloEdits committed Jan 8, 2025
1 parent 36cd197 commit dba0655
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions helix-core/src/shellwords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,25 @@ mod test {
assert_eq!(Some("ENV_PATH"), args.get_flag::<&str>("env").unwrap());
}

#[test]
fn should_error_on_unknown_flag() {
let shellwords = Shellwords::from(":w --foo");
let args = Args::from_signature(
shellwords.args(),
ParseMode::Parameters,
&[Flag {
long: "no-format",
short: None,
desc: "test",
accepts: None,
completer: None,
}],
);

assert_eq!(":w", shellwords.command());
assert!(args.is_err());
}

#[test]
fn should_split_args_no_slash_unescaping() {
let input = r#"single_word twó wörds \\three\ \"with\ escaping\\"#;
Expand Down

0 comments on commit dba0655

Please sign in to comment.