Commit graph

38 commits

Author SHA1 Message Date
Daniel Hofstetter
29e5d0b42b clippy: fix redundant_clone lint warnings in tests 2024-04-21 01:26:50 +02:00
Sylvestre Ledru
d8f28364f0
Merge pull request #5168 from cakebaker/chown_remove_duplication_in_tests
chown: remove some duplication in tests
2023-08-21 12:22:32 +02:00
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Daniel Hofstetter
8b9509a55b chown: remove some duplication in tests 2023-08-18 16:11:11 +02:00
Daniel Hofstetter
29f011e28c Remove users crate 2023-06-04 14:55:16 +02:00
Moïse Valvassori
b29f8b011b
chown: show "ownership of 'foo' retained" message
* Display a message when the owner is not changed.

* Display a message when the current user/group doesn't match those specified in the `--from` args.

* print messages to stdout

* Show the message "ownership of 'foo' retained as 'bar'" for every path entry when `chown -v -R --from=`

* fix chown tests: test stdout and not stderr

* factorize duplicate code in a function

* Display a message when the owner is not changed.

* Display a message when the current user/group doesn't match those specified in the `--from` args.

* print messages to stdout

* Show the message "ownership of 'foo' retained as 'bar'" for every path entry when `chown -v -R --from=`

* fix chown tests: test stdout and not stderr

* factorize duplicate code in a function

* display the retained ownership details according to the destination ownership.
2023-05-24 09:45:19 +02:00
Moïse Valvassori
0130a07579
chown: show message if file doesn't exist
* print the message "failed to change ownership of" when we try to change a non existing file.

* replace the 4-tuple returned by parse_gid_uid_and_filter by GidUidOwnerFilter struct.

* chain the test in one expression.

* chown: remove unused var "result" in test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-05-21 17:54:32 +02:00
Daniel Hofstetter
7a888da409 tests: remove all "extern crate" statements 2023-04-10 08:31:31 +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
Sylvestre Ledru
49eb9a2e91
Merge branch 'main' into cp-pathbuf 2023-03-05 16:22:21 +01:00
Thayne McCombs
17f9507e17 Add tests for non-utf8 2023-02-21 22:58:39 -07: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
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00
Terts Diepraam
96b6252910
Merge pull request #4081 from sylvestre/chown-sep
chown: fails when XXXX. or XXXX: is provided (when XXXX is numeric value)
2022-10-26 11:24:35 +02:00
Sylvestre Ledru
9f1ac221cd chown: fails when XXXX. or XXXX: is provided (when XXXX is numeric values)
If the arg starts with an id numeric value, the group isn't set but the separator is provided,
we should fail with an error

Should fix tests/chown/separator.sh
2022-10-25 08:25:05 +02:00
Jeffrey Finkelstein
55b3766c10 clippy fixes 2022-10-23 13:56:20 -04:00
Sylvestre Ledru
6e14dea73b Fix some clippy warnings
Fixed with `cargo clippy --features unix  --fix`
and manually
2022-10-13 09:07:22 +02:00
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Jeffrey Finkelstein
163df8abc1 fixup! chown: allow setting arbitrary numeric user ID 2022-05-12 08:41:17 +02:00
Jeffrey Finkelstein
55550e1a6e chown: allow setting arbitrary numeric user ID
Update `chown` to allow setting the owner of a file to a numeric user
ID regardless of whether a corresponding username exists on the
system.

For example,

    $ touch f && sudo chown 12345 f

succeeds even though there is no named user with ID 12345.

Fixes #3380.
2022-05-12 08:41:17 +02:00
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Daniel Eades
784f2e2ea1 use semicolons if nothing returned 2022-01-30 15:08:26 +01:00
Sylvestre Ledru
75e5c42e40
chown: support '.' as 'user.group' separator (like ':') (#2638)
* chown: support '.' as 'user.group' separator (like ':')

It also manages the case:
user.name:group (valid too)

Should fix:
gnu/tests/chown/separator.sh
2021-09-10 08:15:23 +02:00
Sylvestre Ledru
f8c4b56174 Remove comment on test_chown_only_group_id 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
99764b8e6e Add "cuuser" to the spell ignore in tests 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
00221a4d36 Silent test_chown_only_group_id on freebsd 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
697dca25cb silent the failed tests for now on freebsd 2021-08-24 09:32:27 +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
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
df2dcc5b99 chown: fix parse_spec() for colon (#2060) 2021-04-18 00:11:59 +02:00
Jan Scheer
c81cf9b626 chown: refactor tests 2021-04-14 17:36:45 +02:00
Sylvestre Ledru
cd97adb39d Minor fixes in the tests 2020-12-13 12:11:42 +01:00
Sylvestre Ledru
dca1f28085 install: various improvements in output & tests 2020-12-12 14:36:23 +01:00
Sylvestre Ledru
55c660b986 feature(install): move chown functions into uucore and have install owner support use it 2020-12-12 14:27:59 +01:00
Sylvestre Ledru
49b32ea68d
refactor(chown): move to clap & add tests (#1648) 2020-12-12 00:14:00 +01:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_chown.rs (Browse further)