Commit Graph
19 Commits
Author SHA1 Message Date
oech3andoech3 97f8a08ddd users: Avoid > /dev/full panic 2026-01-12 17:13:08 +09:00
Daniel Hofstetter 1004ba7f63 users: fix unused imports in tests on FreeBSD 2025-08-16 16:57:43 +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
Jadi 576341bb93 users: support OpenBS using utmp
OpenBSD uses the original utmp file format so the general `users` does not
work there. By using the `utmp-classic` lib, we cna process the current users
on the system from the /var/run/utmp and show the list.

fixes #5665
2024-06-29 08:19:24 +03:30
Daniel Hofstetter 2f9fcf73fa clippy: fix warnings introduced by Rust 1.74 2023-11-16 16:21:28 +01:00
Sylvestre Ledru bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Miles Liu 81a4e8fb7d Remove keep_env from the test framework 2023-03-24 14:25:37 +08:00
Daniel Hofstetter 6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Joining7943 1c230fd779 tests/util: Refactor UCommand and TestScenario.
Summary of changes in UCommand:
* Extend UCommand by builder methods and simplify methods in TestScenario
* Simplify code structures where possible. Add documentation.
* Store bin_path as PathBuf and util_name as String in all structs
* Remove UCommand::util and make bin_path, temp_dir private
* Rename UCommand::with_limit -> UCommand::limit

Summary of changes in TestScenario:
* Rename some parameters in TestScenario methods to be more descriptive
* Remove ucmd_keepenv, cmd_keepenv from TestScenario. Use UCommand::keep_env instead.
2023-02-18 23:38:20 +01:00
Terts Diepraam 9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Justin Tracey 687dcaef9f users and who: ignore failing tests for now 2022-03-07 12:32:07 -05: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 4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Jan Scheer 714661774b users: fix long_help text and clippy warning 2021-05-29 02:34:43 +02:00
Gilad Naaman b91fadd8f4 Refactored tests for more utilities 2021-04-18 02:32:43 +03:00
Roy Ivy III de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00