summaryrefslogtreecommitdiff
path: root/test/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix comment detection on open parensNoam Postavsky2017-01-231-0/+85
| | | | | | | | | | | | | | | Characters having both open paren syntax and comment start syntax were being detected as open parens even when they should have been part a comment starter (Bug#24870). * src/syntax.c (in_2char_comment_start): New function, extracted from `scan_sexps_forward'. (scan_sexps_forward): Add check for a 2-char comment starter before the loop. Inside the loop, do that check after incrementing the 'from' character index. Move the single char comment syntax cases into the switch instead of special casing them before. * test/src/syntax-tests.el (parse-partial-sexp-paren-comments): (parse-partial-sexp-continue-over-comment-marker): New tests.
* Check that variable lists are actually listsPhilipp Stephani2017-01-191-0/+10
| | | | | | | | | | 'let' and 'let*' document that their first argument has to be a list, but don't check for that; instead, they allow (and silently ignore) other types. Introduce an explicit type check. * src/eval.c (Flet, FletX): Check that the variable list is indeed a list. * test/src/eval-tests.el: Add unit tests.
* Rudimentary error handling for non-main threadsEli Zaretskii2017-01-181-4/+13
| | | | | | | | | | | | | | * src/thread.c (last_thread_error): New static variable. (syms_of_threads): Staticpro it. (record_thread_error, Fthread_last_error): New functions. (syms_of_threads): Defsubr Fthread_last_error. * doc/lispref/threads.texi (Basic Thread Functions): Document thread-last-error. * test/src/thread-tests.el (thread-errors, thread-signal-early) (threads-condvar-wait): Test the values returned by thread-last-error.
* Fix last changeEli Zaretskii2017-01-131-9/+9
| | | | | | * test/src/thread-tests.el (threads-condvar-wait): Revert previous change. Make sure no other threads from previous tests are running, to avoid interfering with our thread counts.
* Fix the new condvar testEli Zaretskii2017-01-131-2/+3
| | | | | | * test/src/thread-tests.el (threads-condvar-wait): Enlarge the time we sleep in the main thread to let the other thread process notifications.
* Minor improvements in the new condvar testEli Zaretskii2017-01-131-11/+14
| | | | | | | | * test/src/thread-tests.el (threads-test-condvar-wait): Use with-mutex instead of emulating it inline. (threads-condvar-wait): Improve comments. Check that the new thread is alive before waiting for it to become blocked on the conditional variable.
* Fix a bug in waiting for condition variableEli Zaretskii2017-01-131-0/+41
| | | | | | | | | | | * src/thread.c (lisp_mutex_lock, lisp_mutex_unlock) (lisp_mutex_unlock_for_wait, condition_wait_callback) (condition_notify_callback): Improve commentary. (condition_wait_callback): Call post_acquire_global_lock before attempting to lock the mutex, to make sure the lock's owner is recorded correctly. * test/src/thread-tests.el (threads-condvar-wait): New test.
* Add support for Unicode whitespace in [:blank:]Philipp Stephani2017-01-061-1/+1
| | | | | | | | | | | | | | | | See Bug#25366. * src/character.c (blankp): New function for checking Unicode horizontal whitespace. * src/regex.c (ISBLANK): Use 'blankp' for non-ASCII horizontal whitespace. (BIT_BLANK): New bit for range table. (re_wctype_to_bit, execute_charset): Use it. * test/lisp/subr-tests.el (subr-tests--string-match-p--blank): Add unit test for [:blank:] character class. * test/src/regex-tests.el (test): Adapt unit test. * doc/lispref/searching.texi (Char Classes): Document new Unicode behavior for [:blank:].
* Update copyright year to 2017 in masterPaul Eggert2017-01-0111-11/+11
| | | | | | Run admin/update-copyright in the master branch. This fixes files that were not already fixed in the emacs-25 branch before it was merged here.
* Merge from origin/emacs-25Paul Eggert2017-01-0114-14/+14
| | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
* Treat incomplete integer literals as errorsPhilipp Stephani2016-12-231-0/+8
| | | | | | | | See Bug#25120. * src/lread.c (read_integer): Treat incomplete integer literals as errors. * test/src/lread-tests.el (lread-empty-int-literal): New unit test for incomplete integer literals.
* ; Spelling fixesPaul Eggert2016-12-221-1/+1
|
* * src/data.c (Fmake_variable_frame_local): RemoveStefan Monnier2016-12-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'. * src/data.c (swap_in_symval_forwarding, set_internal) (set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Don't pay attention to ->frame_local any more. (syms_of_data): Remove Qtrapping_frame_local and don't defsubr Smake_variable_frame_local. * etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal of make-variable-frame-local. * lisp/help-fns.el (describe-variable): Don't handle the now impossible frame-local case. * lisp/subr.el (make-variable-frame-local): Remove obsolescence data. * src/frame.c (store_frame_param): * src/eval.c (specbind): Don't pay attention to ->frame_local any more. * src/widget.c (first_frame_p): Remove, unused.
* * test/src/regex-resources/PTESTS: Convert to UTF-8.Paul Eggert2016-12-121-271/+271
|
* Avoid crashing if a new thread is signaled right awayEli Zaretskii2016-12-121-0/+9
| | | | | | | | | | | * src/thread.c (post_acquire_global_lock): Don't raise the pending signal if the thread's handlers were not yet set up, as that will cause Emacs to exit with a fatal error. This can happen if a thread is signaled as soon as make-thread returns, before the new thread had an opportunity to acquire the global lock, set up the handlers, and call the thread function. * test/src/thread-tests.el (thread-signal-early): New test.
* Fix point motion in cloned buffersEli Zaretskii2016-12-121-1/+11
| | | | | | | | | | | | | | | | | | * src/thread.c (post_acquire_global_lock): Call set_buffer_internal_2 instead of tricking set_buffer_internal_1 into resetting the current buffer even if it didn't change. This avoids bug#25165, caused by failing to record the modified values of point and mark, because current_buffer was set to NULL. Also, don't bother re-setting the buffer if there was no thread switch, as that just wastes cycles. * src/buffer.c (set_buffer_internal_2): New function, with most of the body of set_buffer_internal_1, but without the test for B being identical to the current buffer. (set_buffer_internal_1): Call set_buffer_internal_2 if B is not identical to the current buffer. * src/buffer.h (set_buffer_internal_2): Add prototype. * test/src/thread-tests.el (thread-sticky-point): New test.
* Avoid aborts when a thread signals an errorEli Zaretskii2016-12-111-0/+15
| | | | | | | | | | | | * src/thread.h (struct thread_state): Add members m_waiting_for_input and m_input_available_clear_time. (waiting_for_input, input_available_clear_time): New macros. * src/keyboard.c (waiting_for_input, input_available_clear_time): Remove; they are now macros that reference the current thread. (Bug#25171) * src/w32select.c: Don't include keyboard.h. * test/src/thread-tests.el (thread-errors): New test.
* ; Fix copyright years in new filesGlenn Morris2016-12-101-1/+1
|
* Support concurrency in Emacs LispEli Zaretskii2016-12-102-0/+294
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge branch 'test-concurrency' * src/thread.c: * src/thread.h: * src/systhread.c: * src/systhread.h: New files. * src/xgselect.c (xg_select): Avoid using SAFE_NALLOCA and use xnmalloc unconditionally. * src/window.c (struct save_window_data): Rename current_buffer to f_current_buffer. * src/w32proc.c (sys_select): Change the function signature to closer fit 'pselect' on Posix hosts. * src/search.c: * src/regex.h: Convert some globals to macros that reference thread-specific values. * src/process.c (pset_thread, add_non_keyboard_read_fd) (add_process_read_fd, add_non_blocking_write_fd) (recompute_input_desc, compute_input_wait_mask) (compute_non_process_wait_mask, compute_non_keyboard_wait_mask) (compute_write_mask, clear_waiting_thread_info) (update_processes_for_thread_death, Fset_process_thread) (Fprocess_thread): New functions. (enum fd_bits): New enumeration. (fd_callback_data): Add 'thread' and 'waiting_thread', rename 'condition' to 'flags'. (set_process_filter_masks, create_process, create_pty) (Fmake_serial_process, finish_after_tls_connection) (connect_network_socket, deactivate_process) (server_accept_connection, wait_reading_process_output) (Fcontinue_process, Fstop_process, keyboard_bit_set) (add_timer_wait_descriptor, add_keyboard_wait_descriptor) (delete_keyboard_wait_descriptor): Use the new functions instead of manipulating fd flags and masks directly. (syms_of_process): Defsubr the new primitives. * src/print.c (print_object): Print threads, mutexes, and conditional variables. * src/lisp.h (enum pvec_type): New values PVEC_THREAD, PVEC_MUTEX, and PVEC_CONDVAR. (XTHREAD, XMUTEX, XCONDVAR, THREADP, MUTEXP, CONDVARP) (CHECK_THREAD, CHECK_MUTEX, CHECK_CONDVAR): New inline functions. (XSETTHREAD, XSETMUTEX, XSETCONDVAR): New macros. (struct handler): Add back byte_stack. Rename lisp_eval_depth to f_lisp_eval_depth. * src/eval.c (specpdl_kind, specpdl_arg, do_specbind) (rebind_for_thread_switch, do_one_unbind) (unbind_for_thread_switch): New functions. (init_eval): 'handlerlist' is not malloc'ed. (specbind): Call do_specbind. (unbind_to): Call do_one_unbind. (mark_specpdl): Accept 2 arguments. (mark_specpdl): Mark the saved value in a let-binding. * src/emacs.c (main): Call init_threads_once, init_threads, and syms_of_threads. * src/data.c (Ftype_of): Support thread, mutex, and condvar objects. (Fthreadp, Fmutexp, Fcondition_variable_p): New functions. (syms_of_data): DEFSYM and defsubr new symbols and primitives. * src/bytecode.c (struct byte_stack, FETCH, CHECK_RANGE) (BYTE_CODE_QUIT): Add back. (exec_byte_code): Add back byte stack manipulation. * src/alloc.c (cleanup_vector): Handle threads, mutexes, and conditional variables. (mark_stack): Now extern; accept additional argument 'bottom'. (flush_stack_call_func): New function. (garbage_collect_1): Call mark_threads and unmark_threads. Don't mark handlers. * src/.gdbinit (xbytecode): Add back. * test/src/thread-tests.el: New tests. * test/src/data-tests.el (binding-test-manual) (binding-test-setq-default, binding-test-makunbound) (binding-test-defvar-bool, binding-test-defvar-int) (binding-test-set-constant-t, binding-test-set-constant-nil) (binding-test-set-constant-keyword) (binding-test-set-constant-nil): New tests. * doc/lispref/processes.texi (Processes and Threads): New subsection. * doc/lispref/threads.texi: New file * doc/lispref/elisp.texi (Top): Include it. * doc/lispref/objects.texi (Thread Type, Mutex Type) (Condition Variable Type): New subsections. (Type Predicates): Add thread-related predicates. * doc/lispref/objects.texi (Editing Types): * doc/lispref/elisp.texi (Top): Update higher-level menus. * etc/NEWS: Mention concurrency features.
| * Fix the test suiteEli Zaretskii2016-12-062-0/+294
| | | | | | | | | | | | * test/automated/bindings.el: Contents moved to test/src/data-tests.el. * test/automated/threads.el: Moved to test/src/thread-tests.el.
* | Give test-completion's PREDICATE the hashtable keyNoam Postavsky2016-12-061-4/+1
| | | | | | | | | | | | | | | | For hashtable entries with symbol keys, `test-completion' would convert the key to a string before calling PREDICATE, unlike `try-completion' and `all-completions'. * src/minibuf.c (Ftest_completion): Pass original key from hashtable.
* | Give test-completion's PREDICATE full alist entryNoam Postavsky2016-12-061-0/+406
|/ | | | | | | | | | | Since 2016-06-26 "Fix test-completion with completion-regexp-list", when calling test-completion with an alist collection, the predicate was recieving the string value instead of the alist entry (Bug#24966). * src/minibuf.c (Ftest_completion): Don't modify the found element, just test STRING against `completion-regexp-list'. * test/src/minibuf-tests.el: New tests for `try-completion', `all-completions', and `test-completion'.
* Add tests for watchpointsNoam Postavsky2016-12-021-0/+115
| | | | | * test/src/data-tests.el (data-tests-variable-watchers): (data-tests-local-variable-watchers): New tests.
* Prevent dubious argument listsPhilipp Stephani2016-11-181-0/+15
| | | | | | | | | | See Bug#24912 and Bug#24913. * src/eval.c (funcall_lambda): Detect more dubious argument lists. * lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): Detect more dubious argument lists. * test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Add unit test.
* Fix crash in evaluating functionsPhilipp Stephani2016-10-131-0/+35
| | | | | | | | | See Bug#24673 * src/eval.c (funcall_lambda): Fix crash for bogus functions such as (closure). * test/src/eval-tests.el (eval-tests--bug24673): Add test.
* ; * test/src/undo-tests.el: Moved from test/lisp/legacy/.Eli Zaretskii2016-09-241-0/+448
|
* ; * test/src/textprop-tests.el: Minor copyedits.Eli Zaretskii2016-09-241-0/+3
|
* ; * Move test/lisp/legacy/textprop-tests.el to test/src/.Eli Zaretskii2016-09-241-0/+69
|
* ; * test/src/process-tests.el: Renamed from test/lisp/legacy/process-tests.el.Eli Zaretskii2016-09-241-0/+166
|
* ; * test/src/font-tests.el: Minor copyedits.Eli Zaretskii2016-09-241-2/+3
|
* ; * test/src/font-tests.el: Moved from test/lisp/legacy/font-parse-tests.el.Eli Zaretskii2016-09-241-0/+166
|
* Move coding-tests.el and decoder-test.el to their placesEli Zaretskii2016-09-241-1/+326
| | | | | | * test/src/coding-tests.el: Added all the tests from test/lisp/legacy/decoder-tests.el. * test/lisp/legacy/decoder-tests.el: File deleted.
* ; * test/src/coding-tests.el: Moved from test/lisp/legacy/.Eli Zaretskii2016-09-241-0/+58
|
* Split regex character class test into smaller chunksMichal Nazarewicz2016-09-091-44/+46
| | | | | | | | | | | | | | | | | | | | | | | | Having one test for all character classes it is not always trivial to determine which class is failing. This happens when failure is caused by ‘(should (equal (point) (point-max)))’ not being met. With per-character class tests, it is immidiatelly obvious which test causes issues plus tests for all classes are run even if some of them fail. * test/src/regex-tests.el (regex-character-classes): Delete and split into… (regex-tests-alnum-character-class, regex-tests-alpha-character-class, regex-tests-ascii-character-class, regex-tests-blank-character-class, regex-tests-cntrl-character-class, regex-tests-digit-character-class, regex-tests-graph-character-class, regex-tests-lower-character-class, regex-tests-multibyte-character-class, regex-tests-nonascii-character-class, regex-tests-print-character-class, regex-tests-punct-character-class, regex-tests-space-character-class, regex-tests-unibyte-character-class, regex-tests-upper-character-class, regex-tests-word-character-class, regex-tests-xdigit-character-class): …new tests.
* New file test/src/marker-tests.elMartin Rudalics2016-09-081-0/+60
|
* Avoid crashes for invalid value of key modifiersEli Zaretskii2016-08-291-0/+7
| | | | | | | | | | * src/keyboard.c (parse_solitary_modifier): If the argument SYMBOL is not a symbol, don't try to recognize it. See http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00502.html for the details. * test/src/keymap-tests.el (keymap-where-is-internal-test): New test, for testing the above fix.
* Add tests for 'substitute-command-keys'Eli Zaretskii2016-08-181-0/+92
| | | | | * test/src/doc-tests.el (doc-test-substitute-command-keys): New tests.
* Spelling and minor grammar fixesPaul Eggert2016-08-051-5/+5
| | | | * test/file-organization.org: Rename from test/file-organisation.org.
* Fix accessing regex-resources in out-of-tree test runs in regex-testsMichal Nazarewicz2016-08-031-1/+6
| | | | | | | | | | | | | | | | [82a487d: Fix reading of regex-resources in regex-tests] attempted to fix regex-tests failing when run from the source tree (i.e. via make) by hard-coding path to regex-resources directory relative to the test directory. This fixed runs from the tree but broke the test when run using other methods. Fix by trying ‘load-file-name’ or ‘buffer-file-name’, whichever is set. * test/src/regex-tests.el (regex-tests--resources-dir): New variable storing path to the regex-resources directory. (regex-tests-generic-line): Use aforementioned variable.
* Fix unused lexical variableMichal Nazarewicz2016-08-021-3/+2
| | | | | | | | | | This fixes the following warning: In toplevel form: src/regex-tests.el:416:1:Warning: Unused lexical variable ‘newline’ * test/src/regex-tests.el (regex-tests-BOOST): Remove unused lexical variable.
* Split regex glibc test cases into separet testsMichal Nazarewicz2016-08-021-6/+18
| | | | | | | | * test/src/regex-tests.el (regex-tests): Remove and split into multiple tests cases. (regex-tests-glbic-BOOST, regex-tests-glibc-PCRE, regex-tests-glibc-PTESTS, regex-tests-glibc-TESTS): New test cases split from ‘regex-tests’.
* Don’t (require 'cl)Michal Nazarewicz2016-08-021-4/+3
| | | | | * test/src/regex-test.el: Don’t (require 'cl). (regex-tests-PCRE): s/loop/cl-loop/
* Fix reading of regex-resources in regex-testsMichal Nazarewicz2016-08-021-6/+5
| | | | | | | | | | | * test/src/regex-tests.el (regex-tests-generic-line): Referring to ‘buffer-file-name’ does not work when running the test from command line, i.e. via make, which results in (wrong-type-argument stringp nil) failures. Replace it with hard-coded path. (regex-tests-BOOST, regex-tests-PCRE, regex-tests-PTESTS-whitelist, regex-tests-TESTS-whitelist): ‘regex-tests-generic-line’ now includes the ‘regex-resources’ path component so the tests don’t need to specify it explicitly.
* Added driver for the regex testsDima Kogan2016-08-021-0/+572
| | | | | | | * test/src/regex-tests.el (regex-tests): Test executing glibc tests cases. [mina86@mina86.com: merged test with existing file]
* New regex tests imported from glibc 2.21Dima Kogan2016-08-024-0/+3723
| | | | | | | | | | * test/src/regex-resources/BOOST.tests: * test/src/regex-resources/PCRE.tests: * test/src/regex-resources/PTESTS: * test/src/regex-resources/TESTS: New test data files [mina86@mina86.com: Moved files from test/src/regex/* to test/src/*.]
* Fix ‘[[:cc:]]*literal’ regex failing to match ‘literal’ (bug#24020)Michal Nazarewicz2016-07-251-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regex engine tries to optimise Kleene star by avoiding backtracking when it can detect that star’s operand cannot match what follows it in the pattern. For example, when ‘[[:alpha:]]*1’ tries to match a ‘foo’, the engine will test the longest match for ‘[[:alpha:]]*’, namely ’foo’ which is the entire string. Literal digit one still present in the pattern will however not match the remaining empty string. Normally, backtracking would be performed trying a shorter match for the character class (namely ‘fo’ leaving ‘o’ in the string), but since the engine knows whatever would be put back into the string cannot possibly match literal digit one so no backtracking will be attempted. In the regexes of the form ‘[[:CC:]]*X’, the optimisation can be applied if the character class CC does not match character X. In the above example, this holds because digit one is not in alpha character class. This test is performed by mutually_exclusive_p function but it did not check class bits of a charset opcode. This resulted in an assumption that character classes do not match multibyte characters. For example, it would incorrectly conclude that [[:alpha:]] doesn’t match ‘ż’. This, in turn, led to the aforementioned Kleene star optimisation being incorrectly applied in patterns such as ‘[[:graph:]]*☠’ (which should match ‘☠’ but doesn’t as can be tested by executing (string-match-p "[[:graph:]]*☠" "☠") which should return 0 but instead yields nil. This issue affects any class witch matches multibyte characters, i.e. if ‘[[:cc:]]’ matches a multibyte character X then ‘[[:cc:]]*X’ will fail to match ‘X’. * src/regex.c (executing_charset): A new function for executing the charset and charset_not opcodes. It performs check on the character taking into consideration existing bitmap, range table and class bits. It also advances the pointer in the regex bytecode past the parsed opcode. (CHARSET_LOOKUP_RANGE_TABLE_RAW, CHARSET_LOOKUP_RANGE_TABLE): Removed. Code now included in executing_charset. (mutually_exclusive_p, re_match_2_internal): Changed to take advantage of executing_charset function. * test/src/regex-tests.el: New file with tests for the character class matching.
* Fix 'transpose-regions' when LEAVE-MARKERS arg is non-nilEli Zaretskii2016-07-191-0/+45
| | | | | | | | | | | | | | * src/insdel.c (adjust_markers_bytepos): New function. * src/lisp.h (adjust_markers_bytepos): Add prototype. * src/insdel.c (replace_range, replace_range_2): * src/editfns.c (Ftranspose_regions): Call adjust_markers_bytepos. (Bug#5131) * test/src/editfns-tests.el (transpose-test-reverse-word) (transpose-test-get-byte-positions): New functions. (transpose-ascii-regions-test) (transpose-nonascii-regions-test-1) (transpose-nonascii-regions-test-2): New tests.
* Keep w32 environment settings internal onlyNoam Postavsky2016-07-181-0/+39
| | | | | | | | | | * src/emacs.c (main) [WINDOWSNT]: Move init_environment calls after the set_initial_environment call. This prevents Emacs' modifications to the environment from contaminating Vprocess_environment and Vinitial_environment (Bug #10980). * src/callproc.c (getenv_internal) [WINDOWSNT]: Consult Emacs' internal environment in as a fallback to Vprocess_environment. * test/src/callproc-tests.el (initial-environment-preserved): New Test.
* Test mapcanMario Lang2016-07-111-0/+10
| | | | * test/src/fns-tests.el (fns-tests-mapcan): New test.
* Minor tweaks of copying text properties when padding stringsEli Zaretskii2016-07-091-2/+26
| | | | | | | | * src/editfns.c (styled_format): Don't include padding on the left in the properties at the beginning of the string. (Bug#23897) * test/src/editfns-tests.el (format-properties): Add tests for faces when the string is padded on the left or on the right.