Restrict short-hand flag detection to exact match. (#1406)

This commit is contained in:
Andrés N. Robalino
2020-02-18 01:58:30 -05:00
committed by GitHub
parent 0f7c723672
commit 18d988d4c8
2 changed files with 30 additions and 2 deletions

View File

@ -56,6 +56,29 @@ mod parse {
-r, --raw: Prints the raw value representation.
*/
#[test]
fn errors_if_flag_passed_is_not_exact() {
let actual = nu_error!(cwd: ".", "debug -ra");
assert!(
actual.contains("unexpected flag"),
format!(
"error message '{}' should contain 'unexpected flag'",
actual
)
);
let actual = nu_error!(cwd: ".", "debug --rawx");
assert!(
actual.contains("unexpected flag"),
format!(
"error message '{}' should contain 'unexpected flag'",
actual
)
);
}
#[test]
fn errors_if_flag_is_not_supported() {
let actual = nu_error!(cwd: ".", "debug --ferris");