1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

wc: Don't read() if we only need to count number of bytes (Version 2) (#1851)

* wc: Don't read() if we only need to count number of bytes

* Resolve a few code review comments

* Use write macros instead of print

* Fix wc tests in case only one thing is printed

* wc: Fix style

* wc: Use return value of first splice rather than second

* wc: Make main loop more readable

* wc: Don't unwrap on failed write to stdout

* wc: Increment error count when stats fail to print

* Re-add Cargo.lock
This commit is contained in:
Árni Dagur 2021-03-30 18:53:02 +00:00 committed by GitHub
parent 3e06882acc
commit 698dab12a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1382 additions and 1152 deletions

View file

@ -25,7 +25,7 @@ fn test_stdin_line_len_regression() {
.args(&["-L"])
.pipe_in("\n123456")
.run()
.stdout_is(" 6\n");
.stdout_is("6\n");
}
#[test]
@ -34,7 +34,7 @@ fn test_stdin_only_bytes() {
.args(&["-c"])
.pipe_in_fixture("lorem_ipsum.txt")
.run()
.stdout_is(" 772\n");
.stdout_is("772\n");
}
#[test]
@ -59,7 +59,7 @@ fn test_single_only_lines() {
new_ucmd!()
.args(&["-l", "moby_dick.txt"])
.run()
.stdout_is(" 18 moby_dick.txt\n");
.stdout_is("18 moby_dick.txt\n");
}
#[test]