Dorian Peron
6e23d4e979
tests: patch tests to simplify imports
2025-07-01 03:36:46 +02:00
Tomasz Guz
b5e0304ea7
expr: fix builtin functions precedence
2025-06-13 14:51:25 +02:00
Tomasz Guz
6049bc091a
expr: fix substr parsing
2025-06-11 22:53:24 +02:00
Teemu Pätsi
4946922c0f
expr: Fix error message for large numbers as range index
2025-05-27 17:28:19 +03:00
Teemu Pätsi
07caa4867b
expr: Fix error message for too big range quantifier index
2025-05-27 14:06:15 +03:00
Teemu Pätsi
b1a91351bc
expr: Ignore test cases from spell checker
2025-05-27 04:34:38 +03:00
Teemu Pätsi
bbc912eb75
expr: Add tests for regex range quantifiers
2025-05-27 04:26:37 +03:00
Teemu Pätsi
aae62072d8
expr: Fix parsing range quantifiers in regex
2025-05-26 15:59:35 +03:00
Teemu Pätsi
63ce37cf6e
expr: Refactor regex tests into multiple targeted functions
2025-05-24 11:17:39 +03:00
Teemu Pätsi
b0390fe36e
expr: Handle $
at the beginning of the regex pattern
2025-05-24 01:47:35 +03:00
Teemu Pätsi
4555e6fe48
expr: Handle trailing backslash error
2025-05-24 01:47:30 +03:00
Teemu Pätsi
29332865a9
expr: Handle special cases for $
in regex
...
Enable fixed test `test_bre11`
2025-05-23 15:29:55 +03:00
Teemu Pätsi
f664578a4b
expr: Handle special cases for ^
in regex
2025-05-23 15:23:21 +03:00
Teemu Pätsi
4ee53acad0
expr: Fix parsing negated character classes "[^a]" ( #7884 )
...
* expr: Fix regex escape logic
We have to track if the previous character was already escaped to determine
if the '\' character should be interpreted as an escape character.
* expr: Fix parsing caret (^) as character class negation token
* expr: Add tests for parsing carets in regex
* expr: Add missing semicolon
* expr: Simplify boolean assignment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-05-04 17:35:18 +02:00
Dorian Péron
f49e120877
Merge pull request #7846 from frendsick/fix/expr-regex-option-singleline
...
expr: Fix regex anchor matching behavior with `REGEX_OPTION_SINGLELINE`
2025-05-02 13:35:10 +02:00
Teemu Pätsi
07501be4ae
expr: Escape anchor characters within pattern ( #7842 )
...
* expr: Escape anchor characters within the core pattern
The anchor characters `^` and `$` are not considered special characters by `expr`
unless they are used as expected on the start or end of the pattern.
2025-04-27 23:52:35 +02:00
Teemu Pätsi
c6e2f9fd9a
expr: Enable ignored test_anchor test
2025-04-26 18:28:21 +03:00
Sylvestre Ledru
a0179ea239
uutests: adjust the tests to use them
2025-03-28 21:40:31 +01:00
Louis DISPA
a236f85e9d
expr: Add a long input test
...
Test a stack overflow that was happening on linux for long inputs.
2025-03-13 17:05:51 +01:00
Daniel Hofstetter
df4dfea852
tests: replace run() with succeeds() or fails()
2025-03-09 16:53:56 +01:00
Dorian Peron
a9d8eed217
expr: Remove useless arg in enum variant
2025-03-04 10:27:55 +01:00
Dorian Peron
985ac3b381
test(expr): Add GNU tests to rust testsuite
2025-03-04 10:27:55 +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
Dorian Peron
4513b58e59
test(expr): Add test for eager evaluation
2025-02-23 16:22:06 +01:00
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