Commit graph

130 commits

Author SHA1 Message Date
Roy Ivy III
7133efd0a5 tests ~ fix cargo clippy complaint (clippy::needless_return) 2021-11-19 17:55:02 -06:00
Thomas Queiroz
f43dfa9a61
tests/common: implement CmdResult::usage_error 2021-11-09 16:36:03 -03:00
Thomas Queiroz
0bbc805e43
tests/common: add util_name+bin_path to CmdResult 2021-11-09 16:36:03 -03:00
Thomas Queiroz
ab4573bde9
tests/common: create TestScenario::composite_cmd
This is made to call UCommand::new with Some(util_name)
2021-11-09 16:35:38 -03:00
Thomas Queiroz
d4ca4371d7
tests/common: add util_name+bin_path to UCommand 2021-11-09 04:04:56 -03:00
Thomas Queiroz
fc300dda24
tests/common: UCommand::new rename arg to bin_path
Merge and remove unecessary `.as_ref()`
2021-11-09 00:12:11 -03:00
Thomas Queiroz
007f1b9f84
uu+tests: use strip_prefix and strip_suffix 2021-10-24 12:23:32 -03:00
Sylvestre Ledru
c43436d50a
Merge pull request #2710 from jfinkels/tests-add-missing-assert-placeholder
tests: add template string to assert! statements
2021-10-19 20:53:35 +02:00
Jan Scheer
bfa8a2a068
tests/util: add more wrappers for common file handling tasks
truncate, rename, remove, copy, rmdir, etc.
2021-10-19 01:12:12 +02:00
Jeffrey Finkelstein
9e21d26b7c tests: add template string to assert! statements
Add missing "{}" template strings to `assert!()` statements.
2021-10-11 16:51:14 -04:00
Sylvestre Ledru
00de952592 Fix various 'if_then_panic' clippy warnings 2021-10-10 09:57:39 +02:00
Jan Scheer
e9371dc57d
common/util: fix parsing of coreutil version
For the CICD on macOS, this fixes:

```
---- common::util::tests::test_check_coreutil_version stdout ----
---- common::util::tests::test_expected_result stdout ----
thread 'common::util::tests::test_expected_result' panicked at
'byte index 4 is out of bounds of `9.0`', tests/common/util.rs:1172:41
```
2021-10-02 00:58:04 +02:00
Jan Verbeek
0a3785bf84 whoami: Run tests on Windows 2021-09-14 14:13:58 +02:00
Sylvestre Ledru
450a3faf9f
Add to the spell ignore list 2021-09-13 12:29:28 +02:00
Jan Scheer
deedb73bcb
tests/common: make call to host_name_for idempotent
This fixes an issue on macOS/bsd where multiple calls
to `host_name_for` each added a prefix 'g'.
The issue led to some tests being skipped because `util_name` was
renamed to e.g. "ggid" instead of "gid".
2021-09-13 12:28:47 +02:00
Jan Verbeek
b4c95d49d8
pwd: Properly resolve logical working directory (#2604)
* pwd: Properly resolve logical working directory

* fixup! pwd: Properly resolve logical working directory

* fixup! pwd: Properly resolve logical working directory
2021-08-28 22:31:20 +02:00
Roy Ivy III
4da46d93c7 tests ~ fix tests for new execution_phrase!() and usage phrasing 2021-08-14 14:01:34 +02:00
Jeffrey Finkelstein
2a4c0a867a tests: better arg names in link helper functions
Change the argument names in

* `AtPath::hard_link()`,
* `AtPath::symlink_file()`, and
* `AtPath::symlink_dir()`,

from `src` and `dest` to `original` and `link` to match the arguments of
the corresponding functions from the Rust standard library. For example,
see `std::os::unix::fs::symlink()`.
2021-08-01 19:50:58 -04:00
Sylvestre Ledru
caf984bd55 fix various clippy issues 2021-07-11 11:22:33 +02:00
Jan Scheer
14b348dd4b
tests: fix tests for CICD environment 2021-07-08 11:17:18 +02: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
c447863c8d
tests/common: refactor to reduce duplicate code
* move fn expected_result to common/util.rs
* move fn check_coreutil_version to common/util.rs
* move fn whoami to common/util.rs
* move macro unwrap_or_return to common/macros.rs
* add documentation
* add tests
2021-07-07 14:59:14 +02:00
Michael Debertol
98088db9ff tests: add _any functions
This should make it easier to write tests that could have different
valid outputs depending on timing.
2021-06-12 18:03:00 +02:00
Michael Debertol
8e7eedebe7 tests: take slices in stdout_is_fixture 2021-06-12 18:03:00 +02:00
Jan Scheer
ae03b09c6d tests/util: add CmdResult::new() 2021-06-11 09:08:14 +02:00
Roy Ivy III
7df5acc2dc tests ~ fix cargo clippy complaint (*allow* clippy::manual_strip; with FixME/ToDO)
- replace with the included/noted code when MSRV includes a stabilized `String::strip_prefix()`
2021-06-06 19:28:25 -05:00
Michael Debertol
e5c4681e04 tests: add the ability to set resource limits 2021-06-02 19:21:12 +02:00
Michael Debertol
fc2b61eb96 tests: typo 2021-06-01 23:06:51 +02:00
Sylvestre Ledru
badf7aacb7
Merge pull request #2300 from tertsdiepraam/pr
Implement `pr` (resurrection of the resurrected PR)
2021-05-31 21:14:57 +02:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Terts Diepraam
7690dc018f Merge branch 'master' into pr 2021-05-31 15:23:06 +02:00
Terts Diepraam
b0bf3e7e0f pr: rustfmt test_pr.rs and utils.rs 2021-05-29 19:34:17 +02:00
Terts Diepraam
bc1870c0a7 Merge branch 'master' into pr 2021-05-29 19:21:31 +02:00
Jan Scheer
3aeccfd802 fix a lot of clippy warnings 2021-05-29 15:11:22 +02:00
Terts Diepraam
0487360507 pr: make tests compile again 2021-05-29 14:30:30 +02:00
Sylvestre Ledru
9442f26fdb
Merge pull request #2283 from Mikadore/master
Closing #1916 - Concluding the test refactor
2021-05-28 22:36:47 +02:00
Mikadore
29f6dd1f35 Fixed warning 2021-05-27 16:55:14 +02:00
Mikadore
5e1d52d4be cargo-fmt :DDD 2021-05-26 22:20:16 +02:00
Mikadore
64598d9e26 Closing #1916 2021-05-26 22:15:28 +02:00
Jan Scheer
afb1b9efb4 tests/util: add AtPath::hard_link 2021-05-26 12:53:11 +02:00
Jeffrey Finkelstein
eeef8290df head: display errors for each input file
Change the behavior of `head` to display an error for each problematic
file, instead of displaying an error message for the first problematic
file and terminating immediately at that point. This change now matches
the behavior of GNU `head`.

Before this commit, the first error caused the program to terminate
immediately:

    $ head a b c
    head: error: head: cannot open 'a' for reading: No such file or directory

After this commit:

    $ head a b c
    head: cannot open 'a' for reading: No such file or directory
    head: cannot open 'b' for reading: No such file or directory
    head: cannot open 'c' for reading: No such file or directory
2021-05-17 08:19:47 -04:00
rethab
231bb7be93
Migrate mknod to clap, closes #2051 (#2056)
* mknod: add tests for fifo

* mknod: add test for character device
2021-05-05 22:59:40 +02:00
Christopher Regali
368e984fac
Change unchecked unwrapping to unwrap_or_default for Args-trait (#1845) (#1852)
* Change unchecked unwrapping to unwrap_or_default for argument parsing (resolving #1845)

* Added unit-testing for the collect_str function on invalid utf8 OsStrs

* Added a warning-message for identification purpose to the collect_str method.

* - Add removal of wrongly encoded empty strings to basename
- Add testing of broken encoding to basename
- Changed UCommand to use collect_str in args method to allow for integration testing of that method
- Change UCommand to use unwarp_or_default in arg method to match the behaviour of collect_str

* Trying out a new pattern for convert_str for getting a feeling of how the API feels with more control

* Adding convenience API for compact calls

* Add new API to everywhere, fix test for basename

* Added unit-testing for the conversion options

* Added unit-testing for the conversion options for windows

* fixed compilation and some merge hiccups

* Remove windows tests in order to make merge request build

* Fix formatting to match rustfmt for the merged file

* Improve documentation of the collect_str method and the unit-tests

* Fix compilation problems with test

Co-authored-by: Christopher Regali <chris.vdop@gmail.com>
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-04-25 23:28:42 +02:00
Michael Debertol
2084c3ddf3 tests: show pretty diffs for assertion failures
- All assert_eq in tests/common/util.rs now print a pretty diff on test
failures.
- {stdout, stderr}_is_fixture now compare the expected output and the
fixture as Strings, which leads to more usable diffs.
2021-04-24 16:43:13 +02:00
Sylvestre Ledru
8ccc6ade61
Merge branch 'master' into split-wsl-detection 2021-04-24 10:24:13 +02:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Gilad Naaman
c5d7f63b3c Make CmdResult::code private 2021-04-17 18:50:41 +03:00
Gilad Naaman
0d1946a5d2 cksum: Remove direct usage of CmdResult fields in tests 2021-04-17 15:08:23 +03:00
Sylvestre Ledru
fc057b816b
Merge branch 'master' into split-wsl-detection 2021-04-17 10:22:54 +02:00