Commit graph

40 commits

Author SHA1 Message Date
Sylvestre Ledru
6b70dc232e
test: -o arg should trigger an error (#6642)
* test: -o arg should trigger an error

Should fix tests/test/test-diag.pl

* test: use var directly in string

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-08-13 11:05:35 +02:00
Laurent Cheylus
de4d91beda
tests: disable failed tests for test on OpenBSD
Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-07-06 22:29:19 +02:00
n4n5
ab67947321
fix clippy tests 2024-06-30 16:27:08 +02:00
Daniel Hofstetter
9bb725cefc clippy: fix warnings introduced by Rust 1.75 2023-12-28 18:17:06 +01:00
Nathan Houghton
1915e3c438 tests/test: Ensure the test fixture files have the expected gid
On some platforms (mostly the BSDs) the test fixture files copied to the
/tmp directory will have a different gid than the current egid (due to
the sticky bit set on the /tmp directory). Fix this before running the
"test" command.
2023-12-25 13:10:22 +01:00
Nathan Houghton
0ea1a7cd88 tests/cp, tests/test: Don't attempt to set sticky file bit on FreeBSD
On FreeBSD (and OpenBSD), only the superuser can set the file sticky
bit.
2023-12-02 16:58:27 +01:00
Nathan Houghton
dbfd700502 test: use mtime for -ot and fix direction of comparison
- Use the file modification time instead of the creation time (matches
  GNU coreutils documentation)

- Fix direction of comparison (a < b instead of a > b)

- Extend test case to cover both the 0 and 1 exit code cases
2023-10-22 17:44:40 -07:00
Terts Diepraam
c3f9e19a3b all: normalize license notice in all *.rs files 2023-08-24 12:21:09 +02:00
Sylvestre Ledru
bf5b765cba
Remove the author copyright notices (#5184)
* Remove the author copyright notices

Rational:
* not maintained
* does not reflect reality
* don't provide any value (the info can be found in the git log)
* we don't have rules to update them
  (ex: should you update it after one line, two lines, etc)

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-08-21 12:23:18 +02:00
leon3s
bf94e8fff1 test: refactor error handling with ParseError enum 2023-03-25 14:03:45 +01:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Joining7943
fdf0f96a01 tests/util: Restructure UCommand to run in shell per default. Introduce constant TESTS_BINARY.
Summary of changes in tests/util:

* Introduce global constant TESTS_BINARY holding the path to `coreutils`
* Implement running an arbitrary command in a sh or cmd shell per default.
* Implement std::fmt::Display for UCommand.
* Change usages of UCommand::util_name from &Option<OsStr> to Option<OsStr>
* `UCommand::new_from_tmp`: Use OsStr directly instead of TempDir -> String -> OsStr
* Collect arguments in `UCommand::args` field
* Build environment variables in `UCommand` itself instead of `std::process::Command`
* Move building of std::process:Command from fields in UCommand to own method `build`
* Remove assertions of UCommand::has_run in arg, args and env.

Summary of changes in tests/by-util:

* Remove usages of UCommand::raw. Fix tests to use UCommand::to_string.
* test_test: Adjust test_invalid_utf8_integer_compare to use `UCommand::args`
* test_chmod: run_single_test
* test_pwd: symlinked_env
* test_cp:
    Fix the usage of &Option<OsStr> in `test_src_base_dot`
    Refactor test_src_base_dot to not use UCommand::new but ts.ucmd() instead
2023-02-17 17:39:33 +01:00
Terts Diepraam
fc7e51a4f8
Merge pull request #4261 from Joining7943/tests-util-enhance-cmdresult
`tests/util`: Implement enhancements of `CmdResult` #4259
2023-01-25 10:06:32 +01:00
Joining7943
1fadeb43b2 tests/util: Do not trim stderr in CmdResult::stderr_is. Add method stderr_trimmed_is.
Fix tests assert whitespace instead of trimming it. Disable some tests in `test_tr` because `tr`
produces too many newlines.
2023-01-22 14:56:19 +01:00
Sylvestre Ledru
b9e972094b test: add a test matching what busybox is doing 2023-01-07 09:50:50 +01:00
Terts Diepraam
44ea43f058 tests: remove status_code, which is the same as code_is 2023-01-01 17:25:59 +01:00
Niyaz Nigmatullin
cefc4f6736 tests: fixed some tests on Windows
Tests used to use system `touch` and `ls` instead of
testing bench `fixtures.touch` and `uu_ls`
2022-10-18 10:00:28 +03:00
Terts Diepraam
72d7287b11 test: update to clap 4 2022-10-13 17:50:43 +02:00
Sylvestre Ledru
858b2a5b99 disable the new tests 2022-10-04 17:24:06 +02:00
Sylvestre Ledru
33de6c89db test: allow parsing of bigger numbers
Fixes: tests/misc/test.pl
2022-10-03 20:25:45 +02:00
Sylvestre Ledru
f0b8b33dc1 test: add support for -ef, -nt & -ot 2022-10-03 20:25:42 +02:00
Sylvestre Ledru
63203a0a68 test: add -N FILE exists and has been modified since it was last read
Upstream: tests/misc/test-N.sh
2022-10-03 00:59:39 -10:00
Jan Scheer
391709c911
tests: ignore failing tests for FreeBSD (#3778) 2022-08-13 10:09:05 +02:00
Terts Diepraam
96d3a95a39 test: fix wsl executable permission 2022-01-31 00:22:21 +01:00
Jan Verbeek
259f18fcab Update message quoting and filename printing 2021-09-07 19:49:01 +02:00
Sylvestre Ledru
a0be9811c6
Merge pull request #2513 from drocco007/test-parentheses
test: handle additional parentheses edge cases
2021-09-06 22:23:21 +02:00
Sylvestre Ledru
697dca25cb silent the failed tests for now on freebsd 2021-08-24 09:32:27 +02:00
Daniel Rocco
d8d71cc477 test: handle additional parentheses edge cases
Handle additional edge cases arising from test(1)’s lack of reserved words.
For example, left parenthesis followed by an operator could indicate
either

* string comparison of a literal left parenthesis, e.g. `( = foo`
* parenthesized expression using an operator as a literal, e.g. `( = != foo )`
2021-07-24 23:02:02 -04:00
Michael Debertol
bc0727cc4d [: add support for --help and --version
I copied the help text verbatim from GNU, I hope that's ok.
2021-07-06 13:15:07 +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
Tuomas Tynkkynen
7b9814c778 test: Implement [ expr ] syntax
When invoked via '[' name, last argument must be ']' or we bail out with
syntax error. Then the trailing ']' is simply disregarded and processing
happens like usual.
2021-06-19 18:49:21 +03:00
Tuomas Tynkkynen
d05964a8cb test: Implement -k
parser.rs already accepts this, finish the implementation.
2021-06-18 00:03:08 +03:00
Daniel Rocco
22fbf16b2c test: implement user, group ownership checks
closes #2337
2021-06-14 14:30:17 -04: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
efd5921bda tests/test: replace call to 'ln -s' with call to 'AtPath::symlink_file' 2021-05-26 13:42:12 +02:00
Daniel Rocco
2ec4bee350 test: improve handling of inverted Boolean expressions
- add `==` as undocumented alias of `=`

- handle negated comparison of `=` as literal

- negation generally applies to only the first expression of a Boolean chain,
  except when combining evaluation of two literal strings
2021-05-10 22:48:40 -04:00
Daniel Rocco
3c126bad72 test: implement parenthesized expressions, additional tests
- Replace the parser with a recursive descent implementation that handles
  parentheses and produces a stack of operations in postfix order.

  Parsing now operates directly on OsStrings passed by the uucore framework.

- Replace the dispatch mechanism with a stack machine operating on the
  symbol stack produced by the parser.

- Add tests for parenthesized expressions.

- Begin testing character encoding handling.
2021-05-01 22:40:47 -04:00
Daniel Rocco
c3912d53ac test: add tests for basic tests & edge cases
Some edge cases covered:

- no args
- operator by itself (!, -a, etc.)
- string, file tests of nothing
- compound negations
2021-05-01 22:40:47 -04:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_test.rs (Browse further)