1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

wc: avoid excess String allocations

print_stats will now take advantage of the buffer built into
io::stdout().

We can also waste fewer lines on show! by making a helper macro.
This commit is contained in:
Jed Denlea 2023-03-31 19:52:52 -07:00
parent c3b06e10a6
commit 38b4825e7f
3 changed files with 41 additions and 81 deletions

View file

@ -375,7 +375,7 @@ fn test_read_from_directory_error() {
#[cfg(not(windows))]
const STDERR: &str = ".: Is a directory";
#[cfg(windows)]
const STDERR: &str = ".: Access is denied";
const STDERR: &str = ".: Permission denied";
#[cfg(not(windows))]
const STDOUT: &str = " 0 0 0 .\n";
@ -392,10 +392,7 @@ fn test_read_from_directory_error() {
/// Test that getting counts from nonexistent file is an error.
#[test]
fn test_read_from_nonexistent_file() {
#[cfg(not(windows))]
const MSG: &str = "bogusfile: No such file or directory";
#[cfg(windows)]
const MSG: &str = "bogusfile: The system cannot find the file specified";
new_ucmd!()
.args(&["bogusfile"])
.fails()