Commit graph

30 commits

Author SHA1 Message Date
Sylvestre Ledru
09e53f3d2d tests: fix some clippy warnings 2024-05-25 09:06:16 +02:00
Terts Diepraam
00b9cbe09e expr: coerce to string before comparing values 2023-12-18 22:24:31 +01:00
Coba Weel
7efe33108a Fix issue 5576 (regex matching bug in expr)
Issue 5576 reported a bug in expr, found by the fuzzer. The problem
turns out to be with the regex match operator `:`, which is defined in
POSIX and the GNU manual to match the pattern only when it occurs at
the beginning of the string, i.e., the regex has an implicit `^`
prepended to it. We hadn't been doing that.
2023-11-23 16:26:37 +01:00
Daniel Hofstetter
c2bfb6a465 expr: adapt error messages, revert most of #5559 2023-11-23 15:14:25 +01:00
Daniel Hofstetter
2e77d99dd4 expr: fail fast if there are no operands 2023-11-23 14:35:02 +01:00
Sylvestre Ledru
af021e0d4f
Merge pull request #5559 from pawelngei/expr-substr-error
expr: different stderr with `expr "56" "substr"`
2023-11-22 14:56:42 +01:00
Zhuoxun Yang
44702940d2 tests/expr: check prefix operation 2023-11-21 22:06:20 +08:00
ALXD
8b650a7a9b expr: add tests for precise error messages 2023-11-21 10:14:24 +01:00
Zhuoxun Yang
04ab5b0108 tests/expr: add tests for "" 2023-10-17 22:26:19 +08:00
Zhuoxun Yang
7421c81a22 tests/expr: sort test cases 2023-10-17 22:21:44 +08:00
Luv_Ray
46b8b41e3f
Merge branch 'main' into fix-expr-syntex-error 2023-10-14 23:50:21 +08:00
Zhuoxun Yang
5b1755387f tests/expr: test escape 2023-10-14 23:18:15 +08:00
Daniel Hofstetter
f6880bff8f expr: test some invalid syntaxes 2023-10-14 14:58:41 +02:00
Zhuoxun Yang
40f05a331e tests/expr: add tests for test_and 2023-10-14 01:58:53 +08:00
Zhuoxun Yang
e5d70d444a tests/expr: format 2023-10-07 10:41:10 +08:00
Luv_Ray
7bf4b7f674
tests/expr: add tests in test_expr.rs 2023-10-07 00:42:04 +08:00
Zhuoxun Yang
5a732dd21a tests/expr: add test expr 1 \| a / 5 2023-10-06 23:50:44 +08:00
Daniel Hofstetter
ff500d7d6f expr: interpret numbers != 0 as true for | and & 2023-09-26 16:24:00 +02:00
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Terts Diepraam
44ea43f058 tests: remove status_code, which is the same as code_is 2023-01-01 17:25:59 +01:00
Roy Ivy III
737271de96 test/expr: add regex tests 2022-12-29 23:22:13 -06:00
Roy Ivy III
812d811ff6 test/expr: add simple value and EXIT_CODE tests 2022-12-29 22:49:02 -06:00
Roy Ivy III
be37e033be test/expr: add more index testing of unicode strings 2022-12-29 22:49:02 -06:00
Roy Ivy III
8e7dbb0bf6 test/expr: add 'index' operator tests 2022-12-29 22:48:55 -06:00
Sylvestre Ledru
7225fb6c24 expr: Use chars().count() as we can have some multibytes chars
Partially fixes #3132
Fixes one of the test of tests/misc/expr-multibyte
2022-02-13 14:19:25 +01:00
Michael Debertol
d821719c67
expr: support arbitrary precision integers (#2271)
* expr: support arbitrary precision integers

Instead of i64s we now use BigInts for integer operations. This means
that no result or input can be out of range.
The representation of integer flags was changed from i64 to u8 to make
their intention clearer.

* expr: allow big numbers as arguments as well

Also adds some tests

* expr: use num-traits to check bigints for 0 and 1

* expr: remove obsolete refs

match ergonomics made these avoidable.

* formatting

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-05-29 23:25:23 +02:00
Yağız can Değirmenci
071899d24d tests: delete 'error:' prefix from the tests 2021-05-26 02:45:53 +03:00
Michael Debertol
218f523e1b expr: make substr infallible
Instead of returning an Err it should return the "null string"
(in our case that's the empty string) when the offset or length
is invalid.
2021-05-23 22:22:34 +02:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_expr.rs (Browse further)