Commit Graph

272 Commits (master)

Author SHA1 Message Date
Sébastien Helleu 2b70d71aa1 core: replace argument "keep_eol" by "flags" in function string_split (closes #1322) 2019-03-10 18:29:16 +01:00
Sébastien Helleu 8aa5f5375e core: add value -1 for keep_eol in function string_strip (issue #1322)
The value -1 means it's a standard split, but empty items are kept, and
separators are not removed at beginning/end of string.
2019-03-09 21:56:05 +01:00
Sébastien Helleu 80b980b2af api: add function command_options (issue #928) 2019-02-28 20:19:18 +01:00
Sébastien Helleu c2859096cb api: add function string_match_list 2019-02-27 07:46:22 +01:00
Sébastien Helleu 57aa9e060e spell: rename "aspell" plugin to "spell" (issue #1299)
The following things have been renamed:

- file aspell.conf -> spell.conf
- options aspell.* -> spell.*
- bar item aspell_dict -> spell_dict
- bar item and local variable aspell_suggest -> spell_suggest
- info aspell_dict -> spell_dict
2019-02-19 21:15:56 +01: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 507dfec781 tests: fix UTF-8 tests on FreeBSD
Tests for size on screen are made on U+2EE9 (CJK Radical Simplified Yellow)
instead of U+24B62 (CJK Unified Ideograph-24B62) which returns a length of 1 on
FreeBSD and 2 on Linux.
2019-01-26 09:57:30 +01:00
Sébastien Helleu eb0828ec6c tests: fix link of tests on GNU Hurd and FreeBSD 2019-01-20 16:53:00 +01:00
Sébastien Helleu 142d312ad7 tests: add missing include of stdio.h 2019-01-20 15:59:04 +01:00
Sébastien Helleu 98249ada86 tests: add tests on IRC color functions
Functions tested:

- irc_color_decode
- irc_color_encode
- irc_color_decode_ansi
2019-01-20 15:17:21 +01:00
Sébastien Helleu 34a6fce134 tests: add tests on function irc_protocol_parse_time 2019-01-13 14:47:35 +01:00
Sébastien Helleu c96e2f3593 tests: add tests on function irc_config_check_autojoin 2019-01-11 22:27:28 +01:00
Sébastien Helleu 2b0057239b core: update copyright dates 2019-01-01 15:40:51 +01:00
Sébastien Helleu 4712d0bb06 core: use https for links to GNU GPL license 2018-11-29 23:16:07 +01:00
Sébastien Helleu d8ad7e6a8d tests: add missing file test-secure.cpp in autotools 2018-11-04 15:03:54 +01:00
Sébastien Helleu ed3f281ba9 api: add functions string_base_{encode,decode}, remove functions string_{encode,decode}_base64 2018-11-04 14:49:11 +01:00
Sébastien Helleu 6d72868e15 api: return integer in function string_encode_base16 2018-11-02 14:20:16 +01:00
Sébastien Helleu 8848b0e22a api: return integer in function string_encode_base64 2018-11-02 14:09:23 +01:00
Sébastien Helleu 74a17d821f tests: add tests on functions secure_encrypt_data and secure_decrypt_data 2018-11-02 14:06:14 +01:00
Sébastien Helleu d0ea801724 core: add support of TOTP generation/validation (Time-based One-Time Password) 2018-11-02 14:06:14 +01:00
Sébastien Helleu 8da3458f4c core: add repeat of string in evaluation of expressions with "repeat:count,string" (closes #958) 2018-10-09 21:12:02 +02:00
Sébastien Helleu 82697714e1 core: fix evaluation of nested ternary operators (closes #1263) 2018-10-08 22:51:08 +02:00
Sébastien Helleu 1ff9d1f52a core: add missing slash at the end of weechat.org URLs 2018-09-09 10:00:53 +02:00
Sébastien Helleu 796859b873 core: fix copyright dates 2018-09-01 08:13:12 +02:00
Sébastien Helleu 6bf0dfddd6 core: fix evaluation of condition when the left operand is an empty string 2018-08-18 15:30:16 +02:00
Sébastien Helleu 466dbbe75b core: add option "-P" (or "--plugins") to customize the plugins to load at startup
If given, the option replaces the option weechat.plugin.autoload.
2018-08-17 19:44:41 +02:00
Sébastien Helleu 1a0087a7d7 core: fix string evaluation with regex replacement when the string is empty 2018-08-16 22:45:42 +02:00
Sébastien Helleu ca90f28beb tests: add tests on modifier hook 2018-08-16 18:27:04 +02:00
Sébastien Helleu 057f2c3396 tests: properly initialize variable argc before tests on function string_split 2018-08-15 09:43:35 +02:00
Sébastien Helleu cdc7faf93f tests: add test on function string_split with a string having only delimiters 2018-08-15 09:42:59 +02:00
Sébastien Helleu 12a6f74ec0 core: fix check of tags in lines
All changes:
- fix check of tags in lines: check lines without tags, fix check of tags with
  negation ("!tag")
- add string functions string_split_tags and string_free_split_tags
- add tests on function gui_line_match_tags
2018-08-12 20:30:13 +02:00
Sébastien Helleu e0cecefb0f tests: fix compiler warnings on calls to snprintf 2018-07-13 22:35:39 +02:00
Sébastien Helleu 1abf4040f1 core: add reverse of string in evaluation of expressions with "rev:" (closes #1200) 2018-06-02 16:01:14 +02:00
Sébastien Helleu ab9a0ec2e6 tests: add missing tests on function string_cut 2018-06-02 15:19:16 +02:00
Sébastien Helleu ba19fa9963 core: count number of chars instead of bytes for suffix in function string_cut 2018-06-02 15:18:29 +02:00
Sébastien Helleu 49253bd4d9 tests: fix test of function utf8_strlen_screen on Han char (U+24B62) 2018-06-02 14:42:29 +02:00
Sébastien Helleu afb1d03053 Merge remote-tracking branch 'origin/pr/623' into irc-3.2-cap 2018-05-20 15:21:07 +02:00
Sébastien Helleu ba13d764e6 tests: add tests on eval_expression() with different prefix/suffix 2018-04-17 20:26:45 +02:00
Sébastien Helleu c1dee726d5 tests: turn off memory leak detection only when testing javascript API 2018-04-13 20:57:34 +02:00
Sébastien Helleu 3c97a1abae tests: fix typo in language name 2018-04-13 20:53:34 +02:00
Sébastien Helleu cc06b95ba7 tests: add tests on infolists 2018-04-12 19:47:42 +02:00
Sébastien Helleu 5ae557fa52 tests: fix AST return in TCL 2018-04-11 23:20:12 +02:00
Sébastien Helleu b2344fe5d6 tests: fix AST return in PHP 2018-04-11 23:10:46 +02:00
Sébastien Helleu cb4348df61 tests: fix AST return in Perl 2018-04-11 23:02:02 +02:00
Sébastien Helleu 6de98179bc api: add function string_format_size in scripting API 2018-04-07 13:20:58 +02:00
Sébastien Helleu 9be08943ab tests: fix name of target in dependencies 2018-03-16 22:08:11 +01:00
Sébastien Helleu 805717e9ec core: add binary weechat-headless to run WeeChat without interface (closes #1120)
The optional command line option "--daemon" runs WeeChat like a daemon
(fork, new process group, file descriptors closed).
2018-03-11 09:59:39 +01:00
Sébastien Helleu 688c9d92d0 tests: fix typo in fake ncurses lib header 2018-03-09 07:35:40 +01:00
Sébastien Helleu be7002b70d tests: fix tests on function string_regex_flags 2018-01-07 15:04:24 +01:00
Sébastien Helleu ed4837b2f6 core: update copyright dates 2018-01-05 00:54:18 +01:00
Sébastien Helleu b8c6a5a2e1 tests: add tests on command/completion hooks scripting API functions 2017-10-28 13:12:00 +02:00
Sébastien Helleu 09f3edc2e6 tests: add tests on prefix and color scripting API functions 2017-10-27 01:12:35 +02:00
Sébastien Helleu 0fd1913ae8 tests: add tests on key_bind and key_unbind scripting API functions 2017-10-24 23:33:52 +02:00
Sébastien Helleu 1e6db7b489 tests: fix AST binop in Perl and Lua 2017-10-24 23:32:24 +02:00
Sébastien Helleu 4cff2322a0 tests: fix Tcl assignment 2017-10-24 23:31:51 +02:00
Sébastien Helleu 2b06b53a29 tests: add quotes in Lua tables 2017-10-24 23:30:32 +02:00
Sébastien Helleu a97d734d8b tests: fix Ruby strings 2017-10-24 23:29:38 +02:00
Sébastien Helleu 1cace5588a tests: escape "@" in Perl strings 2017-10-24 23:04:53 +02:00
Sébastien Helleu 1d56e17b2f core: allow floating point and hexadecimal numbers in comparison of evaluated values 2017-10-17 20:43:40 +02:00
Sébastien Helleu ff443c76b5 tests: add missing docstring 2017-10-10 20:17:15 +02:00
Sébastien Helleu 81a447dbb0 tests: add command /testapi.xx in test script, display elapsed time in scripting API tests 2017-10-10 19:43:47 +02:00
Sébastien Helleu 358297ba8f tests: fix instruction "return" in Perl/Guile/PHP output 2017-10-10 19:42:35 +02:00
Sébastien Helleu ee6f28ef18 tests: remove unused variable 2017-10-10 19:41:34 +02:00
Sébastien Helleu 9ac3097679 tests: fix sort of Unparse classes on line number 2017-10-10 08:23:34 +02:00
Sébastien Helleu 8a32249507 javascript: fix detection of libv8 with autotools on Ubuntu Trusty 2017-10-07 21:43:18 +02:00
Sébastien Helleu ee19cfbf49 tests: fix scripting API tests when they are run from autotools build directory 2017-10-07 18:45:16 +02:00
Sébastien Helleu 003f5de16b tests: fix compilation of tests with autotools 2017-10-07 18:45:02 +02:00
Sébastien Helleu ca2c11dea7 tests: remove useless __init__ methods 2017-10-07 18:22:33 +02:00
Sébastien Helleu 703534034d tests: fix comments 2017-10-07 17:05:42 +02:00
Sébastien Helleu e8af853624 tests: add scripting API tests (issue #104)
Automatic tests of scripting API are made with Python scripts:

- unparse.py: convert Python code to other languages
- testapigen.py: generate scripts in all languages to test the API
- testapi.py scripting API tests
2017-10-07 16:51:25 +02:00
Sébastien Helleu 137d5863e2 tests: run command "/debug libs" in tests instead of Travis CI command 2017-10-01 08:00:39 +02:00
Sébastien Helleu e317a6856c tests: add PHP plugin in tests 2017-09-03 21:49:48 +02:00
Sébastien Helleu c65137667b tests: improve tests on dynamic strings 2017-08-20 11:26:23 +02:00
Sébastien Helleu 16661b0cbe tests: display an error if the required locale en_US.UTF-8 is not installed 2017-07-23 15:12:40 +02:00
Sébastien Helleu 8efbf61e66 tests: fix load of plugins in tests after a build with autotools 2017-07-05 21:33:19 +02:00
Linus Heckemann d6c1d02eca core: search WEECHAT_EXTRA_LIBDIR for plugins (closes #971, issue #979)
In addition to searching the statically configured WEECHAT_LIBDIR
(weechat's installation directory) for plugins, search the path
given in the environment variable WEECHAT_EXTRA_LIBDIR. This makes
departing from the FHS standard while keeping the plugins packaged
separately easier. This change was made specifically with the Nix
package manager in mind, but can easily be used by others.
2017-07-05 19:52:48 +02:00
Sébastien Helleu 5e48b50da8 tests: fix double load of plugins when "make install" is executed before tests 2017-07-05 19:41:11 +02:00
Sébastien Helleu a59ce8331a tests: load plugins from build directory instead of installed libdir
This allows to run tests without running "make install".
2017-07-04 22:14:44 +02:00
Sébastien Helleu b879df09b5 tests: check that fset plugin is loaded 2017-06-25 16:35:28 +02:00
Simmo Saan 0a4be02dc3 core: add hashtable_add_from_infolist to API 2017-06-17 20:03:40 +03:00
Simmo Saan 1329dfb57a core: add wildcard matching operators to eval (closes #608) 2017-04-29 17:04:44 +02:00
Sébastien Helleu 5b78cb2a7b tests: fix compilation warning on FreeBSD 2017-04-26 22:28:03 +02:00
Sébastien Helleu 112bebcddf core: add a way to count the suffix length in max chars displayed in cut of string ("cut:" and "cutscr:") (closes #963)
The format to use is one of:

- ${cut:+max,suffix,string}
- ${cutscr:+max,suffix,string}

With the "+" before max, WeeChat ensures there are at most "max" chars in
output, including the length of suffix string.
2017-04-24 22:37:49 +02:00
Sébastien Helleu 94355e2e38 core: ensure length is not negative in function string_strndup 2017-04-22 15:15:54 +02:00
Sébastien Helleu 6ab7af705e tests: fix tests on dynamic strings 2017-04-01 12:16:12 +02:00
Sébastien Helleu bb00b6b8fb core: add ${re:#} to get the index of last group captured in evaluation of expressions 2017-03-30 22:13:14 +02:00
Sébastien Helleu 467f482ea6 core: make "callback_cmp" optional in call to function arraylist_new()
If no callback is given, a default callback is used, which just compares
pointers.
2017-03-30 20:35:16 +02:00
Sébastien Helleu eb2d0ac58a tests: add tests on combining characters in cut/cutscr (evaluation of expression) 2017-03-28 22:09:11 +02:00
Sébastien Helleu 3045021430 core: fix cut of chars in "cutscr" of evaluated strings
This fixes two problems:
- stop before max char displayed with wide chars
- preserve combining chars in the output

Before the fix (wrong):

>> ${cutscr:3,+,こんにちは世界}
== [こん+]
>> ${cutscr:1,+,a${\u0308}}
== [a+]

After the fix (OK):

>> ${cutscr:3,+,こんにちは世界}
== [こ+]
>> ${cutscr:1,+,a${\u0308}}
== [ä]
2017-03-28 20:45:31 +02:00
Sébastien Helleu f99c866f35 core: add cut of string with max chars displayed in evaluation of expressions
The syntax is: ${cutscr:max,suffix,string}.
The string is cut after max chars displayed on screen. If the string is cut,
the optional suffix is added after.
2017-03-27 21:14:51 +02:00
Sébastien Helleu 9a8ec36cbd core: add cut of string in evaluation of expressions
The syntax is: ${cut:max,suffix,string}.
The string is cut after max chars. If the string is cut, the optional suffix is
added after.
2017-03-25 14:19:48 +01:00
Sébastien Helleu edfeb60e32 buflist: new plugin "buflist" (bar with list of buffers) 2017-03-25 14:18:19 +01:00
Sébastien Helleu 83117f8d2a core: add ternary operator (condition) in evaluation of expressions 2017-03-25 14:18:19 +01:00
Sébastien Helleu 07d16903f3 api: add dynamic string functions (string_dyn_*)
New functions:
- string_dyn_alloc
- string_dyn_copy
- string_dyn_concat
- string_dyn_free
2017-03-25 14:18:19 +01:00
Sébastien Helleu 1361602ea5 tests: fix compilation of tests on FreeBSD 11
Some includes were missing in .h files, and the tests must be linked
with intl and execinfo on FreeBSD.
2017-01-13 20:57:59 +01:00
Sébastien Helleu 705d86e684 core: update copyright dates 2017-01-01 11:32:04 +01:00
Andrew Potter 54ee5e0576
tests: add wattr_get/set to fake 2016-10-02 09:51:28 -07:00
Sébastien Helleu 54841f6294 api: fix return of function string_match() when there are multiple masks in the string (issue #812)
Some tests are added as well to test the multiple masks in the string.
2016-10-02 08:58:19 +02:00
Sébastien Helleu e218db3582 tests: add test on the "extra" option on function eval_expression() 2016-08-18 22:11:50 +02:00
Sébastien Helleu eb86def400 core: rename function string_iconv_fprintf to string_fprintf 2016-07-09 18:28:03 +02:00
Sébastien Helleu 22c0966387 tests: add tests on function string_split_command() 2016-05-14 09:14:08 +02:00
Wojciech Kwolek a44bcaf080 core: fix the hardcoded separator in string_split_command 2016-05-08 12:14:17 +02:00
Sébastien Helleu cf6aca1619 core: add pointer in some callbacks (closes #406)
This pointer is the first argument received by callbacks, and the
existing argument "data" is now automatically freed by WeeChat when the
object containing the callback is removed.

With this new pointer, the linked list of callbacks in scripts has been
removed. This will improve speed of scripts (using a lot of hooks),
reduce memory used by scripts and reduce time to unload scripts.

Following functions are affected in the C API:

* exec_on_files
* config_new
* config_new_section
* config_new_option
* hook_command
* hook_command_run
* hook_timer
* hook_fd
* hook_process
* hook_process_hashtable
* hook_connect
* hook_print
* hook_signal
* hook_hsignal
* hook_config
* hook_completion
* hook_modifier
* hook_info
* hook_info_hashtable
* hook_infolist
* hook_hdata
* hook_focus
* unhook_all_plugin
* buffer_new
* bar_item_new
* upgrade_new
* upgrade_read
2016-03-21 18:11:21 +01:00
Sébastien Helleu 50817054f9 tests: add tests on string_split() with keep_eol set to 2 2016-01-23 10:35:07 +01:00
Sébastien Helleu 3330724574 core: update copyright dates 2016-01-01 11:09:53 +01:00
Sébastien Helleu 57b6e320d3 core: fix execution of empty command name
The strings "/" and "/ " are not considered as valid commands any more.
2015-12-31 19:07:14 +01:00
Sébastien Helleu a60075fb39 tests: temporary disable check of javascript plugin
The compilation with autotools fails to detect v8 lib (used by
javascript plugin) on Ubuntu Trusty, so the tests are failing because
javascript plugins is not loaded.

This check will be enabled again when autotools compilation will be
fixed.
2015-12-25 12:02:34 +01:00
Sébastien Helleu 0cda820807 tests: fix compilation with autotools 2015-12-24 23:07:47 +01:00
Sébastien Helleu 415dea5c74 tests: fix locale used to execute tests 2015-12-24 22:48:10 +01:00
Sébastien Helleu 6ff8de5740 tests: check if all plugins are loaded 2015-12-24 22:21:33 +01:00
Mikaela Suomalainen 9f049afb18 core: use Ubuntu Trusty for tests (Travis CI)
The Debian package libcpputest-dev becomes useless as it's available in
the repositories now.
2015-12-20 07:57:36 +01:00
Sébastien Helleu 41cb1bf635 api: fix handle of invalid escape in function string_convert_escaped_chars()
And a new test is now checking that "\" returns "".
2015-08-24 11:05:31 +02:00
Sébastien Helleu 951d1f91a4 api: add function string_hex_dump() 2015-08-22 09:30:08 +02:00
Sébastien Helleu 46a9d17ac3 api: add argument "length" in function utf8_is_valid() 2015-08-18 07:36:48 +02:00
Sébastien Helleu 4ecd8a505f api: fix type of value returned by functions utf8_prev_char, utf8_next_char and utf8_add_offset 2015-07-04 08:39:55 +02:00
Sébastien Helleu 9bf40517d3 api: add support of evaluated sub-strings and current date/time in function string_eval_expression() and command /eval 2015-06-30 20:25:35 +02:00
Sébastien Helleu 2bd2d74a07 api: add function string_eval_path_home() 2015-06-24 07:54:42 +02:00
Sébastien Helleu 9e0fa27525 tests: add package libcpputest-dev for ubuntu/precise (Travis CI) 2015-06-14 14:32:22 +02:00
Sébastien Helleu 3262599413 core: make cpputest optional in cmake compilation
With this fix, WeeChat can be built without tests (if cpputest is not found),
without having to explicitely disable tests ("-DENABLE_TESTS=OFF").
2015-05-17 14:58:10 +02:00
Sébastien Helleu d322389e04 core: add support of full color option name in command /eval and API function string_eval_expression() 2015-04-26 10:29:30 +02:00
Sébastien Helleu b2a68af077 core: add options weechat.look.word_chars_{highlight|input} (closes #55, task #9459) 2015-04-11 18:53:44 +02:00
Sébastien Helleu 8b056d7d24 tests: check that function string_strndup returns NULL if the given string is NULL 2015-03-22 11:14:12 +01:00
Sébastien Helleu cace7471f0 tests: remove compiler warnings about unused parameters 2015-03-06 19:24:24 +01:00
Sébastien Helleu 3eb6cd3cd9 tests: remove unused variables 2015-03-03 07:43:23 +01:00
Sébastien Helleu f6941c20eb tests: remove unused variable 2015-03-02 21:15:23 +01:00
Sébastien Helleu 07c7ecb679 tests: add tests on weelist functions 2015-02-13 08:00:09 +01:00
Sébastien Helleu a020c28ea6 core: update copyright dates 2015-01-01 09:23:23 +01:00
Sébastien Helleu 0cd2aff765 core: use https for WeeChat URLs 2014-12-13 09:16:09 +01:00
Sébastien Helleu 7818e08964 tests: fix compilation of tests with clang (closes #275) 2014-12-10 21:15:40 +01:00
Sébastien Helleu b460055f78 tests: add tests of regex replace with empty regex or regex_replace 2014-11-23 08:32:52 +01:00
Sébastien Helleu e253a2509a tests: add hashtable tests with multiple items giving same hashed key 2014-11-18 20:12:25 +01:00
Sébastien Helleu 0d1abd3899 tests: add tests of functions string_shared_get and string_shared_free 2014-11-03 20:52:02 +01:00
Sébastien Helleu 633a32ccd3 api: add regex replace feature in function string_eval_expression 2014-10-22 21:19:54 +02:00
Sébastien Helleu 5f98f20c94 tests: fix memory leak in hashtable tests 2014-10-16 20:46:31 +02:00
Sébastien Helleu f62f759c3d core: add hide of chars in string in evaluation of expressions
The syntax is: ${hide:char,string}.
All chars in string are replaced with char (which can be one or more chars).
2014-10-16 20:46:06 +02:00
Sébastien Helleu 45a0bfe1b3 tests: add test of function string_split_shell with an empty string 2014-10-12 18:09:57 +02:00
Sébastien Helleu 9249738582 tests: add extra check of argv pointer in test of string_split functions 2014-10-12 18:09:04 +02:00
Sébastien Helleu 8b23106145 tests: initialize argc to -1 instead of 1 before some tests 2014-10-12 18:07:53 +02:00
Sébastien Helleu 5014231818 tests: add some tests on function eval_expression 2014-10-12 17:58:13 +02:00
Sébastien Helleu 2867996d1f core: fix search/insert of elements in sorted arraylist with duplicates
The pointer and index returned is now the first element found with the value
(with the lower index if there are many elements with same value).
And the index for insert is the last element with same value + 1
(the higher index + 1).
2014-10-11 15:47:09 +02:00
Sébastien Helleu f53baf628e Merge branch 'arraylist' 2014-10-05 08:35:17 +02:00
Sébastien Helleu 4c49113036 tests: add tests of hashtable functions 2014-09-03 07:38:46 +02:00
Sébastien Helleu dda1a66fd7 tests: add tests of arraylist functions 2014-09-01 11:51:04 +02:00
Sébastien Helleu 7b546bea2e api: use microseconds instead of milliseconds in functions util_timeval_diff and util_timeval_add 2014-08-29 18:17:27 +02:00
Sébastien Helleu 5424c5f9de core: fix build of tests with autotools 2014-08-25 20:26:19 +02:00
Sébastien Helleu f39b37351c tests: fix build of tests when the build directory is outside source tree (closes #178) 2014-08-25 07:38:38 +02:00
Sébastien Helleu bc34c3cfc2 tests: fix memory leak in tests launcher 2014-08-15 15:08:31 +02:00
Sébastien Helleu dcf46a2ca0 tests: read WeeChat command line arguments in environment variable "WEECHAT_TESTS_ARGS" 2014-08-14 19:15:25 +02:00
Sébastien Helleu 99b7aa9d27 tests: fix memory leaks 2014-08-14 19:13:32 +02:00
Sébastien Helleu 00e79af39c tests: add tests of function string_split_shell 2014-08-14 19:12:00 +02:00