Commit graph

14 commits

Author SHA1 Message Date
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Joining7943
4a2ced5940 tests: Adjust some tests to use improved UChild. test_tac: Ignore pipe tests on windows.
Summary:
* Disable test_retry6 on android because of intermittent failures
* Use wait() instead of wait_with_output in test_cat, test_cp, test_sort
* tests/sort: Simplify usage of test_sigpipe_panic
* Fix tests in test_tee.

tests/tac:
There was a change in the `tests/common/util.rs` test api concerning piped input which may have
revealed a bug in the implementation of tac. Please see also
https://github.com/uutils/coreutils/pull/4136
2022-12-02 13:13:10 +01:00
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Jeffrey Finkelstein
664c7a6ec5 tac: add support for --regex option to tac
Add support for `tac --regex`, where the line separator is interpreted
as a regular expression.
2021-09-11 22:54:55 -04:00
Jeffrey Finkelstein
0e689e78aa tac: support multi-char separator with overlap
Fix a bug in `tac` where multi-character line separators would cause
incorrect behavior when there was overlap between candidate matches in
the input string. This commit adds a dependency on `memchr` in order to
use the `memchr::memmem::rfind_iter()` function to scan for
non-overlapping instances of the specified line separator characters,
scanning from right to left.

Fixes #2580.
2021-08-23 20:16:38 -04:00
jfinkels
4ef35d4a96
tac: correct behavior of -b option (#2523)
* tac: correct behavior of -b option

Correct the behavior of `tac -b` to match that of GNU coreutils
`tac`. Specifically, this changes `tac -b` to assume *leading* line
separators instead of the default *trailing* line separators.

Before this commit, the (incorrect) behavior was

    $ printf "/abc/def" | tac -b -s "/"
    def/abc/

After this commit, the behavior is

    $ printf "/abc/def" | tac -b -s "/"
    /def/abc

Fixes #2262.

* fixup! tac: correct behavior of -b option

* fixup! tac: correct behavior of -b option

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-08-22 21:01:17 +02:00
Jeffrey Finkelstein
d74fb62df7 tac: support null separator 2021-08-01 19:47:21 -04:00
Sylvestre Ledru
fd02ef2dc1
Merge pull request #2516 from jfinkels/tac-read-dir-error-message
tac: correct error message when reading from directory
2021-07-31 09:49:54 +02:00
Jeffrey Finkelstein
2648f330e4 tac: handle no line separators in file
Change the behavior of `tac` when there are no line separators in the
input. Previously, it was appending an extra line separator; this commit
prevents that from happening. The input is now writted directly to
stdout.
2021-07-25 15:19:29 -04:00
Jeffrey Finkelstein
abf4c69b28 tac: correct error message when reading from dir.
Correct the error message produced by `tac` when trying to read from a
directory. Previously if the path 'a' referred to a directory, then
running `tac a` would produce the error message

    dir: read error: Invalid argument

after this commit it produces

    a: read error: Invalid argument

which matches GNU `tac`.
2021-07-25 13:55:24 -04:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Yagiz Degirmenci
e958864bd9
tac: exit with proper code, move from getopts to clap, add test for invalid inputs (#1957) 2021-03-31 21:21:10 +02:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_tac.rs (Browse further)