39 Commits

Author SHA1 Message Date
Sébastien Helleu
a071ee5012 tests: remove dependency on French locale in eval tests 2021-05-16 20:17:07 +02:00
Sébastien Helleu
cf7ac76de9 tests: add missing include of locale.h in eval tests 2021-05-16 19:09:18 +02:00
Sébastien Helleu
e03642e9df tests: add tests on translation in evaluated expressions 2021-05-16 14:09:07 +02:00
Sébastien Helleu
3bf585ba04 core: evaluate left/right part of comparison after split on the comparison operator in ${if:xxx} (closes #1627)
To force evaluation of the expression before doing the comparison (less safe),
the "${eval_cond:xxx}" can be used.

With the old behavior we had:

    >> ${if:a==b}
    == [0]
    >> ${if:${raw:a==b}}
    == [0]
    >> ${if:${eval_cond:${raw:a==b}}}
    == [0]

And with the new behavior, we have:

    >> ${if:a==b}
    == [0]
    >> ${if:${raw:a==b}}
    == [1]
    >> ${if:${eval_cond:${raw:a==b}}}
    == [0]
2021-04-04 14:44:18 +02:00
Sébastien Helleu
8ee7d46605 api: add support of pointer names in function string_eval_expression (direct and in hdata)
These two formats are now supported, if "pointer_name" is present in the
"pointers" hashtable:

* "${pointer_name}": value of pointer (example: "0x1234abcd")
* ${buffer[pointer_name].full_name}: use of a pointer name instead of pointer
  value or list name
2021-03-17 21:57:16 +01:00
Sébastien Helleu
a93e598c35 core: add raw string in evaluation of expressions with "raw:xxx" (closes #1611) 2021-02-05 20:07:16 +01:00
Sébastien Helleu
efc7a588d6 core: update copyright dates 2021-01-02 21:34:16 +01:00
Sébastien Helleu
d413ccdf4f core: add indentation and colors in /eval debug output 2021-01-01 17:08:59 +01:00
Sébastien Helleu
2ad3da03a2 core: display more verbose debug with two "-d" in command /eval
Now a single -d in command /eval shows less debug messages than previous
versions.

To get the same debug messages than previous versions, two -d must be used.
2020-12-31 20:37:43 +01:00
Sébastien Helleu
ee9aa28a8c core: do not remove quotes in arguments of command /eval (closes #1601)
Now, /eval -n -c "a" == "a" returns True instead of False.

When quotes were removed, the condition evaluated was: a" == "a (which is
False).
2020-12-25 00:21:03 +01:00
Sébastien Helleu
b626df72fb core: add evaluation of conditions in evaluation of expressions with "eval_cond:" (closes #1582) 2020-11-14 09:28:46 +01:00
Sébastien Helleu
36c55f6973 tests: fix name of some unit tests 2020-08-05 07:28:30 +02:00
Sébastien Helleu
66d4590dab core: add base 16/32/64 encoding/decoding in evaluation of expressions 2020-05-21 09:36:35 +02:00
Sébastien Helleu
62ccee9505 tests: run tests on plugins only if the plugins are enabled and compiled 2020-05-17 15:29:06 +02:00
Sébastien Helleu
b1c3a29ac7 core: add include comparison operators in evaluation of expressions
New comparison operators:

- "==*": is matching mask, case sensitive (wildcard "*" is allowed)
- "!!*": is NOT matching mask, case sensitive (wildcard "*" is allowed)
- "==-": is included, case sensitive
- "!!-": is NOT included, case sensitive
- "=-": is included, case insensitive
- "!-": is NOT included, case insensitive
2020-05-05 20:43:45 +02:00
Sébastien Helleu
84648a5cd8 tests: add eval tests with debug enabled 2020-02-04 20:56:59 +01:00
Sébastien Helleu
d2dda92daf tests: add eval tests with hdata variables of different types 2020-01-27 23:04:24 +01:00
Sébastien Helleu
b7c09ed084 tests: add eval tests on conditions with text after closing parenthesis 2020-01-27 23:04:24 +01:00
Sébastien Helleu
a6a6fb74c2 tests: add eval tests on conditions with leading and trailing spaces (ignored) 2020-01-27 23:04:24 +01:00
Sébastien Helleu
2839dc7ddf tests: add eval tests on "regex not matching" comparison 2020-01-27 23:04:24 +01:00
Sébastien Helleu
0975c407e0 tests: add eval tests with hdata list name and pointer 2020-01-27 23:04:24 +01:00
Sébastien Helleu
201b4da169 tests: add eval tests with buffer local variables 2020-01-27 23:04:24 +01:00
Sébastien Helleu
8107b5d162 tests: add eval tests on options with different types 2020-01-27 23:04:24 +01:00
Sébastien Helleu
dd13393896 tests: add eval test with empty value for "date:" 2020-01-27 23:04:24 +01:00
Sébastien Helleu
70f0c81a2c tests: add eval tests with invalid values for "modifier:" 2020-01-27 23:04:24 +01:00
Sébastien Helleu
6d9a247df3 tests: add eval tests with invalid values for "repeat:" 2020-01-27 23:04:24 +01:00
Sébastien Helleu
1914ceb74f tests: add eval tests with invalid values for "cut:" and "cutscr:" 2020-01-27 23:04:22 +01:00
Sébastien Helleu
34bb43379a tests: add eval test with invalid value for "hide:" 2020-01-27 21:21:01 +01:00
Sébastien Helleu
070e86bd6e tests: add eval test with invalid regex group 2020-01-27 21:17:17 +01:00
Sébastien Helleu
1d77b9742e tests: add evaluation tests with ternary operator and escape of prefix ("$") 2020-01-27 21:09:54 +01:00
Sébastien Helleu
feb6258910 core: update copyright dates 2020-01-04 10:41:26 +01:00
Sébastien Helleu
e612e63140 core: fix evaluation of condition with nested "if" (closes #1434) 2019-12-18 21:22:36 +01:00
Sébastien Helleu
8fc8f728d4 core: add reverse of string for screen in evaluation of expressions with "revscr:" 2019-10-12 20:14:36 +02:00
Sébastien Helleu
88aa82d672 core: add support of modifiers in evaluation of expressions with "modifier:name,data,string" (issue #60) 2019-10-06 09:13:35 +02:00
Sébastien Helleu
e1a4612797 core: ignore color codes in ${length:xxx} and ${lengthscr:xxx} 2019-09-21 13:54:36 +02:00
Sébastien Helleu
dcfc4e8ed5 core: add "length:xxx" and "lengthscr:xxx" in evaluation of expressions 2019-09-21 07:56:21 +02:00
Sébastien Helleu
997894edc0 core: add calculation of expression in evaluation of expressions with "calc:..." (issue #997) 2019-09-20 21:37:01 +02:00
Sébastien Helleu
73a4901fe1 tests: fix evaluation tests on FreeBSD
The following special sequences are not supported in regular expressions on
FreeBSD:

- "\w": replaced with "[a-zA-Z0-9_]"
- "\S": replaced with "[^ ]" (it should be "[^ \t\n\r\f\v]", but in practice
  only spaces could be a problem when we use this sequence).
2019-01-26 10:00:47 +01:00
Sébastien Helleu
c96e2f3593 tests: add tests on function irc_config_check_autojoin 2019-01-11 22:27:28 +01:00