Commit Graph
26 Commits
Author SHA1 Message Date
Jake Abendroth e8b98bca66 fix(tac): improve error message formatting for file not found scenario 2026-02-23 00:18:42 -08:00
Jake Abendroth dc863e110f fix(tac): update tests for cross-platform error messages and strip_errno
- Remove `(os error 28)` from test_failed_write_is_reported expectation
  to match the intentional strip_errno() behavior
2026-02-23 00:18:42 -08:00
Victor ProkhorovandGitHub 23eb2ada8c tac: support non-UTF-8 separator (#10934) 2026-02-21 09:44:30 -08:00
Christopher Dryden cac4a63ac4 tac: fix stdin piping on Windows by skipping empty mmap results 2026-02-07 17:44:22 +00:00
FidelSchandGitHub d2db87275c tac: add regex flavor translation for compatibility and new test case (#10416) 2026-01-25 23:03:22 +01:00
Chris DrydenandGitHub b5a49f33b5 tac: use temp file for stdin to respect TMPDIR and handle disk-full errors (#10094) 2026-01-09 20:31:46 +01:00
cerdelenandGitHub e3be131bcc tac: fix error message (#9942)
* tac: fix error message

* tac: Remove obsolete error messages from locales
2025-12-31 20:01:12 +01:00
Sylvestre Ledru 741370d771 Fix tac to handle non-UTF-8 filenames 2025-08-14 10:52:24 +02:00
Jan Verbeek 11ef1522ca tac: Flush BufWriter 2025-03-31 13:46:24 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Daniel Hofstetter df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
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
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 LedruandGitHub 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 DegirmenciandGitHub 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