Merge branch 'main' into main

This commit is contained in:
maxer137 2024-04-05 20:43:02 +00:00 committed by GitHub
commit 538f5ba6c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 19 deletions

View file

@ -53,7 +53,7 @@ that scripts can be easily transferred between platforms.
## Documentation
uutils has both user and developer documentation available:
- [User Manual](https://uutils.github.io/coreutils/book/)
- [User Manual](https://uutils.github.io/coreutils/docs/)
- [Developer Documentation](https://docs.rs/crate/coreutils/)
Both can also be generated locally, the instructions for that can be found in
@ -302,7 +302,7 @@ make PREFIX=/my/path uninstall
Below is the evolution of how many GNU tests uutils passes. A more detailed
breakdown of the GNU test results of the main branch can be found
[in the user manual](https://uutils.github.io/coreutils/book/test_coverage.html).
[in the user manual](https://uutils.github.io/coreutils/docs/test_coverage.html).
See <https://github.com/orgs/uutils/projects/1> for the main meta bugs
(many are missing).

View file

@ -436,23 +436,27 @@ pub fn uu_app() -> Command {
.long(options::LENGTH)
.value_parser(value_parser!(usize))
.short('l')
.help("digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8")
.help(
"digest length in bits; must not exceed the max for the blake2 algorithm \
and must be a multiple of 8",
)
.action(ArgAction::Set),
)
.arg(
Arg::new(options::RAW)
.long(options::RAW)
.help("emit a raw binary digest, not hexadecimal")
.action(ArgAction::SetTrue),
.long(options::RAW)
.help("emit a raw binary digest, not hexadecimal")
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::BASE64)
.long(options::BASE64)
.help("emit a base64 digest, not hexadecimal")
.action(ArgAction::SetTrue)
// Even though this could easily just override an earlier '--raw',
// GNU cksum does not permit these flags to be combined:
.conflicts_with(options::RAW),
.long(options::BASE64)
.short('b')
.help("emit a base64 digest, not hexadecimal")
.action(ArgAction::SetTrue)
// Even though this could easily just override an earlier '--raw',
// GNU cksum does not permit these flags to be combined:
.conflicts_with(options::RAW),
)
.after_help(AFTER_HELP)
}

View file

@ -379,13 +379,15 @@ fn test_base64_raw_conflicts() {
#[test]
fn test_base64_single_file() {
for algo in ALGOS {
new_ucmd!()
.arg("--base64")
.arg("lorem_ipsum.txt")
.arg(format!("--algorithm={algo}"))
.succeeds()
.no_stderr()
.stdout_is_fixture_bytes(format!("base64/{algo}_single_file.expected"));
for base64_option in ["--base64", "-b"] {
new_ucmd!()
.arg(base64_option)
.arg("lorem_ipsum.txt")
.arg(format!("--algorithm={algo}"))
.succeeds()
.no_stderr()
.stdout_is_fixture_bytes(format!("base64/{algo}_single_file.expected"));
}
}
}
#[test]

View file

@ -117,6 +117,17 @@ fn test_whitespace_with_char() {
.code_is(1);
}
#[test]
fn test_delimiter_with_byte_and_char() {
for conflicting_arg in ["-c", "-b"] {
new_ucmd!()
.args(&[conflicting_arg, COMPLEX_SEQUENCE.sequence, "-d="])
.fails()
.stderr_is("cut: invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields\n")
.code_is(1);
}
}
#[test]
fn test_too_large() {
new_ucmd!()
@ -289,6 +300,13 @@ fn test_multiple_mode_args() {
}
}
#[test]
fn test_no_argument() {
new_ucmd!().fails().stderr_is(
"cut: invalid usage: expects one of --fields (-f), --chars (-c) or --bytes (-b)\n",
);
}
#[test]
#[cfg(unix)]
fn test_8bit_non_utf8_delimiter() {