mirror of
https://github.com/uutils/coreutils
synced 2024-07-21 18:04:45 +00:00
Merge pull request #5635 from tertsdiepraam/fix-echo-override
`echo`: make `-e` and `-E` override each other
This commit is contained in:
commit
3dad5d4d56
2
.github/workflows/fuzzing.yml
vendored
2
.github/workflows/fuzzing.yml
vendored
|
@ -47,7 +47,7 @@ jobs:
|
|||
- { name: fuzz_date, should_pass: false }
|
||||
- { name: fuzz_expr, should_pass: true }
|
||||
- { name: fuzz_printf, should_pass: false }
|
||||
- { name: fuzz_echo, should_pass: false }
|
||||
- { name: fuzz_echo, should_pass: true }
|
||||
- { name: fuzz_seq, should_pass: false }
|
||||
- { name: fuzz_parse_glob, should_pass: true }
|
||||
- { name: fuzz_parse_size, should_pass: true }
|
||||
|
|
|
@ -154,13 +154,15 @@ pub fn uu_app() -> Command {
|
|||
Arg::new(options::ENABLE_BACKSLASH_ESCAPE)
|
||||
.short('e')
|
||||
.help("enable interpretation of backslash escapes")
|
||||
.action(ArgAction::SetTrue),
|
||||
.action(ArgAction::SetTrue)
|
||||
.overrides_with(options::DISABLE_BACKSLASH_ESCAPE),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::DISABLE_BACKSLASH_ESCAPE)
|
||||
.short('E')
|
||||
.help("disable interpretation of backslash escapes (default)")
|
||||
.action(ArgAction::SetTrue),
|
||||
.action(ArgAction::SetTrue)
|
||||
.overrides_with(options::ENABLE_BACKSLASH_ESCAPE),
|
||||
)
|
||||
.arg(Arg::new(options::STRING).action(ArgAction::Append))
|
||||
}
|
||||
|
|
|
@ -117,6 +117,19 @@ fn test_escape_newline() {
|
|||
.stdout_only("\na\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_override() {
|
||||
new_ucmd!()
|
||||
.args(&["-e", "-E", "\\na"])
|
||||
.succeeds()
|
||||
.stdout_only("\\na\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-E", "-e", "\\na"])
|
||||
.succeeds()
|
||||
.stdout_only("\na\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_no_further_output() {
|
||||
new_ucmd!()
|
||||
|
|
Loading…
Reference in a new issue