Commit graph

40 commits

Author SHA1 Message Date
Terts Diepraam
c3f9e19a3b all: normalize license notice in all *.rs files 2023-08-24 12:21:09 +02:00
Rayhan Faizel
4143859266 tests/stat: Test case for using - and -f together 2023-08-10 08:41:19 +05:30
Daniel Hofstetter
5d03d2d9d4 clippy: fix warnings introduced by Rust 1.71.0 2023-07-13 17:35:33 +02:00
Daniel Hofstetter
7a888da409 tests: remove all "extern crate" statements 2023-04-10 08:31:31 +02:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00
Terts Diepraam
b0224e8145 stat: move unit tests to stat.rs instead of test_stat.rs 2022-11-16 21:17:39 +01:00
Terts Diepraam
7e5b6400e3 stat: use Flags struct instead of u8 bit manipulation 2022-11-16 21:12:40 +01:00
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Jan Scheer
391709c911
tests: ignore failing tests for FreeBSD (#3778) 2022-08-13 10:09:05 +02:00
Jan Scheer
fa94591b72
test_stat: expand scope for stdin tests
On Android and macOS all/some tests for stdin fail with:
`cannot stat '-': No such file or directory`
Apparently the `/dev/stdin` redirect workaround doesn't work for
these targets.
2022-05-12 22:49:34 +02:00
Jan Scheer
d906f09e6e stat: improve handling of stdin/fifo (fix #3485)
* fix https://github.com/uutils/coreutils/issues/3485
* improve the workaround from #3280
* add tests
2022-05-11 12:59:25 +02:00
Sylvestre Ledru
56264ebece
Merge branch 'main' into 2884-time-0.3 2022-05-07 20:57:14 +02:00
Jan Scheer
f5ffa94129
test_stat: add tests for issues with stdin
* add tests for: https://github.com/uutils/coreutils/issues/3485
* add test for: https://github.com/uutils/coreutils/pull/3280
2022-05-05 20:39:50 +02:00
Sylvestre Ledru
10eaaae272 time: take in account the local tz 2022-05-01 17:00:41 +02:00
Sylvestre Ledru
326dc5080d stat: add a test to verify time easily 2022-05-01 17:00:41 +02:00
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Terts Diepraam
18369dc0be all: use array intoiterator 2022-04-05 10:39:31 +02:00
Sylvestre Ledru
936ac0db38
Merge pull request #3053 from snobee/stat-handle-negative-time
stat: allow formatting of negative numbers
2022-02-08 20:45:21 +01:00
snobee
f7e31f6008 stat: allow formatting of negative numbers 2022-02-03 16:01:19 -08:00
Hanif Bin Ariffin
3586465917 dont use is_numeric to check for digits
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-03 21:42:22 +08:00
Sylvestre Ledru
78e28060a0 NORMAL_FORMAT_STR is also used for freebsd 2021-08-24 09:32:27 +02:00
Tuomas Tynkkynen
46a2491727 stat: Support \t in --printf format 2021-07-23 19:04:18 +03:00
Jan Scheer
abc59fbe85
tests/common: refactor: use TestScenario instead of util_name for expected_result() 2021-07-07 22:46:16 +02:00
Jan Scheer
735ec4014e
test_who: refactor use expected_result from common/util.rs 2021-07-07 17:26:59 +02:00
Jan Scheer
805e024794
test_stat: refactor use expected_result from common/util.rs 2021-07-07 15:54:03 +02:00
Jan Scheer
c0be979611 fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.

e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user
```

* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
2021-06-23 11:30:28 +02:00
Roy Ivy III
9feff1e441 tests ~ fix cargo clippy complaint (*allow* clippy::needless_borrow; for *false positives*) 2021-06-06 19:28:25 -05:00
Roy Ivy III
3f35e0a421 refactor ~ cargo make format 2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Jan Scheer
3aeccfd802 fix a lot of clippy warnings 2021-05-29 15:11:22 +02:00
Jan Scheer
007e0a4e7f who/stat/pinky: adjust tests to be compatible with running on macOS
A lot of tests depend on GNU's coreutils to be installed in order
to obtain reference values during testing.
In these cases testing is limited to `target_os = linux`.
This PR installs GNU's coreutils on "github actions" and adjusts the
tests for `who`, `stat` and `pinky` in order to be compatible with macOS.

* `brew install coreutils` (prefix is 'g', e.g. `gwho`, `gstat`, etc.
* switch paths for testing to something that's available on both OSs,
    e.g. `/boot` -> `/bin`, etc.
* switch paths for testing to the macOS equivalent,
    e.g. `/dev/pts/ptmx` -> `/dev/ptmx`, etc.
* exclude paths when no equivalent is available,
    e.g. `/proc`, `/etc/fstab`, etc.
* refactor tests to make better use of the testing API
* fix a warning in utmpx.rs to print to stderr instead of stdout
* fix long_usage text in `who`
* fix minor output formatting in `stat`

* the `expected_result` function should be refactored
    to reduce duplicate code
* more tests should be adjusted to not only run on `target_os = linux`
2021-05-21 11:55:20 +02:00
Jan Scheer
203ee463c7 stat/uucore: refactor - move fsext.rs to uucore 2021-05-10 10:46:00 +02:00
Sylvestre Ledru
01a702c6fd
Merge branch 'master' into issue2167 2021-05-08 20:26:21 +02:00
Jan Scheer
a885376583 uucore: refactor - reduce duplicate code related to fs::display_permissions
This is a refactor to reduce duplicate code, it affects chmod/ls/stat.
* merge `stat/src/fsext::pretty_access` into `uucore/src/lib/feature/fs::display_permissions_unix`
* move tests for `fs::display_permissions` from `test_stat::test_access` to `uucore/src/lib/features/fs::test_display_permissions`
* adjust `uu_chmod`, `uu_ls` and `uu_stat` to use `uucore::fs::display_permissions`
2021-05-08 11:52:41 +02:00
Jan Scheer
5bcfa88f0a stat: fix test to ignore selinux related output 2021-05-03 23:09:45 +02:00
Jan Scheer
56761ba584 stat: implement support for macos 2021-05-03 22:30:56 +02:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Gilad Naaman
600bab52ff shred, stat, tail: Remove direct usage of CmdResult fields in test 2021-04-17 18:50:41 +03:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_stat.rs (Browse further)