Sylvestre Ledru and Dorian Péron
ca0c842e71
touch: drop O_TRUNC on create to close TOCTOU race ( #10019 )
2026-06-04 16:19:26 +02:00
Sylvestre Ledru and Daniel Hofstetter
f057cc6a01
tests: replace .no_stdout().no_stderr() chains with .no_output()
...
Bulk rename of the antipattern across 19 test files (136 occurrences).
.no_output() is the established shorthand in the uutests framework
for asserting both empty stdout and empty stderr.
2026-05-12 09:31:31 +02:00
Sylvestre Ledru and Daniel Hofstetter
50f8d0bcc1
touch: add regression test for pre-epoch date on 32-bit
2026-04-15 10:55:34 +02:00
oech3and oech3
d51d2faa0e
touch: extent a test for many device files
2026-01-12 20:15:22 +09:00
Aaron Ang
e58060927d
fix: use jiff time for touch tests
2026-01-06 15:16:43 -08:00
16c16f44ee
Use libc::UTIME_NOW in touch when updating time to now ( #9870 )
...
* Use libc::UTIME_NOW in touch when updating time to now
* Explicit libc import to satisfy clippy
* Fix location of cfg in touch
* Add cfg gate to libc import to satisfy clippy on windows
* Change cfg gates in touch near libc::UTIME_NOW from unix to linux
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org >
2025-12-31 20:09:14 +01:00
Dmitry Shemetov and Sylvestre Ledru
949f038b3b
test: symlink differently on windows/not
2025-12-23 23:30:47 +01:00
Dmitry Shemetov and Sylvestre Ledru
a1596caa8c
test: capture message with .stderr_contains
2025-12-23 23:30:47 +01:00
Dmitry Shemetov and Sylvestre Ledru
cf2fa7c556
fix: touch -r: dangling symlink reference is accepted Fixes #9703
2025-12-23 23:30:47 +01:00
Daniel Hofstetter
086795d26e
touch: simplify some tests by using new_ucmd!()
2025-09-10 11:28:23 +02:00
Daniel Hofstetter
74ee8fb1c1
touch: adapt expected error message in test
2025-09-10 10:20:04 +02:00
Sylvestre Ledru
71b4de24e6
test: improve support non-utf-8
2025-08-14 10:54:04 +02:00
Sylvestre Ledru
f15dac138e
chmod/readlink/du: improve non-UTF-8 filename handling and code style
2025-08-14 10:52:24 +02:00
Sylvestre Ledru
c0da27addc
touch: fix handling of non-UTF-8 filenames
2025-08-14 10:52:24 +02:00
Daniel Hofstetter
7dc20bbdb0
touch: adapt tests to changes in parse_datetime
2025-08-01 10:23:30 +02:00
Dorian Peron
6e23d4e979
tests: patch tests to simplify imports
2025-07-01 03:36:46 +02:00
c64adee068
touch: add -f flag ( #8274 )
...
* touch: fix f flag
* Update src/uu/touch/src/touch.rs
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org >
* touch: add test for f flag
* Update src/uu/touch/src/touch.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com >
* Update tests/by-util/test_touch.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com >
* remove unnecessary comment
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org >
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com >
2025-06-29 15:26:33 +02:00
Yuri Astrakhan
a27880e8a3
chore: use assert_eq! and assert_ne! instead of assert!
...
Makes intent clearer, and if something fails, prints the values that caused the failure as part of the panic message.
2025-04-08 13:25:41 -04:00
Yuri Astrakhan
982805d3cd
chore: manual inline formatting
...
Minor manual cleanup - inlined many format args. This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs. Note that `&foo` in a `format!` parameter results in a 6% extra performance cost, and does not get inlined by the compiler (yet).
2025-04-08 00:23:21 -04:00
Sylvestre Ledru
a0179ea239
uutests: adjust the tests to use them
2025-03-28 21:40:31 +01:00
Sylvestre Ledru
a85539f530
Run cargo fmt on the tree
2025-03-24 21:33:12 +01:00
M Bussonnier and Dorian Péron
57d0157c6a
split test for 32 and 64 bits systems
2025-03-14 11:00:08 +01:00
M Bussonnier and Dorian Péron
7632acfc90
Fix touch -t with 2 digit years when YY > 68
...
When using `touch -t` with a 2 digit year, the year is interpreted as
a relative year to 2000.
When the year is 68 or less, it should be interpreted as 20xx.
When the year is 69 or more, it should be interpreted as 19xx.
This is the behavior of GNU `touch`.
fixes gh-7280
Arguably 2 digits years should be deprecated as we
are already closer to 2069, than 1969.
2025-03-14 11:00:08 +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
Jeffrey Finkelstein
c23e1db9c5
Use the last, not first, two digits as the year
2025-02-06 22:02:47 -05:00