aboutsummaryrefslogtreecommitdiffstats
path: root/test/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Avoid crashes on MS-Windows due to invalid UNC file namesEli Zaretskii2024-05-221-0/+6
| | | | | | | * src/w32.c (parse_root): Avoid crashes due to invalid (too short) UNC names, such as "\\". (Bug#70914) * test/src/fileio-tests.el (fileio-tests-invalid-UNC): New test.
* * doc/lispref/parsing.texi (Retrieving Nodes): Improve documentation.Juri Linkov2024-02-041-1/+1
| | | | | Update optional arguments 'predicate' and 'include-node' of 'treesit-node-top-level'.
* ; Add 2024 to copyright yearsPo Lu2024-01-0251-51/+51
|
* Fix treesit test (bug#67117)Denis Zubarev2023-12-221-7/+13
| | | | | | * test/src/treesit-tests.el (treesit-search-subtree-forward-1): (treesit-search-subtree-backward-1): Replace treesit--thing-at with treesit-query-capture (treesit--thing-at isn't available in Emacs 29).
* Fix an issue when searching subtree backward (bug#67117)Denis Zubarev2023-12-181-0/+30
| | | | | | | | | | | * src/treesit.c (treesit_traverse_child_helper): Do not call treesit_traverse_sibling_helper when the named node is required and the last child is the named node. Otherwise treesit_traverse_sibling_helper will move cursor to the previous sibling and last node will be skipped. * test/src/treesit-tests.el (treesit-search-subtree-forward-1): (treesit-search-subtree-backward-1): Add tests.
* (report_overlay_modification): Fix bug#65929Stefan Monnier2023-09-131-0/+1
| | | | | | | | | | | | | | Somehow the new overlay code in Emacs-29 changed slightly the test to decide when to run the `modification-hooks` of overlays, with the consequence that these hook functions end up being executed also when text is deleted right after an empty overlay, which is contrary to Emacs-28 behavior as well as contrary to the Texinfo doc. * src/buffer.c (report_overlay_modification): Better reproduce the Emacs-28 code. * test/src/buffer-tests.el (overlay-modification-hooks): Add corresponding test.
* (regexp-tests-backtrack-optimization): Mark it as failingStefan Monnier2023-09-051-0/+1
| | | | | * test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization): The fix for bug#65726 broke some of the optimization added for bug#61514.
* ; Add regression test for bug#65726Mattias Engdegård2023-09-051-0/+4
| | | | | * test/src/regex-emacs-tests.el (regex-tests-mutual-exclusive-inf-rec): New test.
* ; Silence byte-compilerStefan Kangas2023-08-201-0/+1
| | | | | | * test/src/comp-tests.el (native-comp-eln-load-path): Declare. (cherry picked from commit 508d24c8b9aee2c2a4c78ccfef3b5f551a1b2115)
* Fix emacs-lisp-native-compile-and-load eln target directory (bug#64226)Andrea Corallo2023-08-091-2/+4
| | | | | | | | | * lisp/emacs-lisp/comp.el (comp-spill-lap-function): Don't use `byte+native-compile' to select output directory but always axpect it explicit through `native-compile-target-directory'. (batch-byte+native-compile): Set `native-compile-target-directory'. * test/src/comp-tests.el (comp-tests-bootstrap): Set `native-compile-target-directory'.
* ; Re-enable the /dev/urandom testEli Zaretskii2023-08-091-3/+2
| | | | | * test/src/fileio-tests.el (fileio-tests--non-regular-insert): Remove :unstable, but comment out the single failing test.
* Disable failing test (bug#65156)Mattias Engdegård2023-08-091-0/+2
| | | | | | | * test/src/fileio-tests.el (fileio-tests--non-regular-insert): Mark as :unstable, since /dev/urandom is seekable. Do not merge to master.
* Fix bol/bos anchors in tree-sitter :match regexpsBasil L. Contovounesios2023-06-131-2/+2
| | | | | | | | | | | | | | | | | Further regexp fixes to follow separately (bug#64019#29). * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--font-lock-settings): * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): * lisp/progmodes/js.el (js--treesit-font-lock-settings): * lisp/progmodes/python.el (python--treesit-settings): * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): * lisp/progmodes/sh-script.el (sh-mode--treesit-settings): * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): * test/src/treesit-tests.el (treesit-query-api): Anchor :match regexps at beginning/end of string, not line.
* ; Update my mail addressAndrea Corallo2023-06-084-4/+4
| | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el: Update author mail. * lisp/emacs-lisp/comp.el: Likewise. * src/comp.c: Likewise. * test/lisp/emacs-lisp/comp-cstr-tests.el: Likewise. * test/src/comp-resources/comp-test-funcs-dyn.el: Likewise. * test/src/comp-resources/comp-test-funcs.el: Likewise. * test/src/comp-resources/comp-test-pure.el: Likewise. * test/src/comp-tests.el: Likewise.
* Handle #@00 in new reader in a compatible way (bug#63722)Mattias Engdegård2023-05-261-0/+16
| | | | | | | | | | This was a regression from Emacs 28. * src/lread.c (skip_lazy_string, read0): Make #@00 read as nil, which is a quirk from the old reader that we preserve for compatibility. * test/src/lread-tests.el (lread-skip-to-eof): Verify it. Reported by Richard Newton.
* Fix loading SQLite extensionsEli Zaretskii2023-05-201-9/+14
| | | | | | | | | | * src/sqlite.c (sqlite3_db_config) [WINDOWSNT]: Load from the DLL. (Fsqlite_load_extension): Use 'sqlite3_db_config' to enable and disable loading of extensions. Add a few free extensions to the allow-list. Fix testing for the ".dll" extension. (Bug#63590) * test/src/sqlite-tests.el (sqlite-load-extension): Fix the test to require successful load if the extension does exist.
* Fix tree-sitter test (bug#63481)Yuan Fu2023-05-181-1/+1
| | | | | | | | * test/src/treesit-tests.el (treesit-basic-parsing): Latest json parser doesn't return an error on empty buffer or multiple objects anymore [1]. https://github.com/tree-sitter/tree-sitter-json/commit/40a81c01a40ac48744e0c8ccabbaba1920441199
* Comp fix calls to redefined primtives with op-bytecode (bug#61917)Andrea Corallo2023-03-291-1/+17
| | | | | | | | * test/src/comp-tests.el (61917-1): New test. * src/comp.c (syms_of_comp): New variable. * lisp/loadup.el: Store primitive arities before dumping. * lisp/emacs-lisp/comp.el (comp--func-arity): New function. (comp-emit-set-call-subr): Make use of `comp--func-arity'.
* Revert "Comp fix calls to redefined primtives with op-bytecode (bug#61917)"Andrea Corallo2023-03-281-13/+0
| | | | | | | This reverts commit 263d6c38539691c954f4c3057cbe8d5468499b91. These patch series caused a number of regression and more analysis is required.
* ; * test/src/fns-tests.el: Fix last changeKen Brown2023-03-251-1/+1
|
* Fix failure of fns-tests-collate-strings on CygwinKen Brown2023-03-251-2/+2
| | | | | | | | * test/src/fns-tests.el (fns-tests-collate-strings): Use en_XY.UTF-8 instead of en_DE.UTF-8 as an example of an invalid locale; en_DE.UTF-8 is actually a valid locale on Cygwin. Note: The test will still fail on Cygwin releases < 3.5 because of a Cygwin bug. (Bug#62420)
* Comp fix calls to redefined primtives with op-bytecode (bug#61917)Andrea Corallo2023-03-201-0/+13
| | | | | | * lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Fix compilation of calls to redefined primtives with dedicated op-bytecode. * test/src/comp-tests.el (61917-1): New test.
* Add tests for Bug#62207Robert Pluim2023-03-181-0/+18
| | | | | * test/src/keymap-tests.el (keymap-unset-test-remove-and-inheritance): New test.
* Adjust tree-sitter defun navigation (bug#61617)Yuan Fu2023-02-271-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, when you use a tree-sitter navigation function to move to the next beginning of a thing, it jumps over the immediate next thing and lands you at the beginning of the next-next thing. Eg, when point is at the "|", and we evaluate (treesit--navigate-thing pos 1 'beg), we go from | (thing) (thing) to (thing) |(thing) But some might expect point to go to |(thing) (thing) instead, which makes sense. Also, that's how Emacs expect defun navigation functions to work. The discrepancy in expectation causes bug#61617. In this change I made tree-sitter navigation functions to work as what Emacs expects. And what I described for moving to the next beginning of thing is similarly applicable to moving to the end of previous end of thing. * lisp/treesit.el (treesit-beginning-of-defun) (treesit-end-of-defun): Handle the case where defun-skipper moves point back to where we started, by adding a retry. (treesit--navigate-thing): Add a single condition checking for progress to the condition form responsible for checking whether to skip the next defun. Namely (eq pos (funcall advance next)))). * test/src/treesit-tests.el: (treesit--ert-defun-navigation-nested-master) (treesit--ert-defun-navigation-top-level-master): Change tests to reflect the new expectation.
* regex-emacs.c: Reduce the use of backtracking a bit furtherStefan Monnier2023-02-201-0/+11
| | | | | | | | | | | bug#61514 exhibited some undesirable backtracking in a case where it's easy to avoid it by making `mutually_exclusive_p` just a bit more careful. * src/regex-emacs.c (mutually_exclusive_p): Handle `on_failure_jump`s. * test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization): Add a few tests.
* Rename with/without-narrowing to with/without-restrictionEli Zaretskii2023-02-131-16/+16
| | | | | | | | | | | | | | | | | * doc/lispref/commands.texi: * doc/lispref/display.texi: * doc/lispref/positions.texi: * etc/NEWS: * lisp/subr.el: * src/buffer.c: * src/editfns.c: * src/keyboard.c: * src/xdisp.c: * test/src/buffer-tests.el: Rename with-narrowing and without-narrowing to with-restriction and without-restriction. Likewise with internal--with-narrowing and internal--without-narrowing. All callers and documentation changed.
* Merge branch 'scratch/fix-locked-narrowing'Gregory Heytings2023-02-131-0/+106
|\
| * Add an extensive test for labeled (locked) narrowingGregory Heytings2023-02-091-0/+106
| | | | | | | | * test/src/buffer-tests.el (test-labeled-narrowing): New test.
* | Add 'live' property to treesit-node-check (bug#61235)Yuan Fu2023-02-091-1/+13
|/ | | | | | | * doc/lispref/parsing.texi (Accessing Node Information): Document. * src/treesit.c (treesit_parser_live_p): New function. (Ftreesit_node_check): Add 'live' property. * test/src/treesit-tests.el (treesit-node-api): Add tests.
* Make `keymap-set-after' work for menusRobert Pluim2023-01-201-0/+17
| | | | | | | | | | | | It still doesn't work for an AFTER that's a key, though, since `key-parse' produces vectors, and keymaps contain integers. * lisp/keymap.el (keymap-set-after): Only parse AFTER as a key if it's a string. For consistency, use `key-parse' on the definition if it's a string, just like `keymap-set'. * test/src/keymap-tests.el (keymap-tests--command-3): New dummy command. (keymap-set-after-menus): New test. Check that we can insert a menu item after a specific entry.
* Use `key-parse' in `keymap-lookup'Robert Pluim2023-01-201-0/+16
| | | | | | | | | It's stricter than `kbd', and doesn't try to do anything with key sequences that look like macros. * lisp/keymap.el (keymap-lookup): Use `key-parse' instead of `kbd'. * test/src/keymap-tests.el (keymap-set-after-menus): Test the `keymap-set-after' API.
* Fix buffer-list-update-hook for indirect buffersBasil L. Contovounesios2023-01-171-20/+26
| | | | | | | | | | | | | | | | | | Fmake_indirect_buffer can be told whether to run buffer hooks since bug#49160, but until now it ran buffer-list-update-hook irrespective of this. * src/buffer.c (Fmake_indirect_buffer): Don't run buffer-list-update-hook when called with a non-nil INHIBIT-BUFFER-HOOKS argument. (run_buffer_list_update_hook): Don't special-case NULL argument, as no such callers remain. * test/src/buffer-tests.el (buffer-tests-inhibit-buffer-hooks-indirect): Test whether indirect buffer hooks are run regardless of whether base buffer hooks are inhibited. Check that all three buffer hooks, not just kill-buffer-query-functions, are inhibited.
* Fix encoding with 'utf-8-auto'Eli Zaretskii2023-01-121-15/+15
| | | | | | | | | | | | * src/coding.c (encode_coding_utf_8): Fix encoding with 'utf-8-auto': it should produce BOM, per the documentation of the :bom attribute. (Bug#60750) * lisp/international/mule.el (define-coding-system): Doc fix. * test/src/coding-tests.el (coding-tests): Use 'with-coding-priority' instead of 'prefer-coding-system', as the latter has global persistent effect and affects further tests.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-0151-51/+51
|
* Fix tree-sitter typosYuan Fu2022-12-281-1/+1
| | | | | | | * doc/lispref/parsing.texi (Tree-sitter major modes): * lisp/progmodes/java-ts-mode.el: * test/src/treesit-tests.el (treesit-defun-navigation-nested-4): Fix typo.
* Fix treesit--things-around (bug#60355)Yuan Fu2022-12-271-1/+39
| | | | | | | | | | | | | | | Current implementation of treesit--things-around only searches forward for REGEXP and go up the tree until it finds a valid thing, if nothing matches it gives up. This makes it sometimes miss defuns. The new implementation tries multiple times (of search forward + go up) until it exhausts all possible defun nodes. * lisp/treesit.el (treesit--things-around): New implementation. (treesit--navigate-defun): Refactor to use treesit-node-top-level to simplify code, and add some guards in the predicate function. * test/src/treesit-tests.el: (treesit--ert-defun-navigation-elixir-program): New variable. (treesit-defun-navigation-nested-4): New test.
* ; * test/src/treesit-tests.el: remove dead store (bytecomp warning)Mattias Engdegård2022-12-271-3/+1
|
* Add a new tree-sitter query predicate 'pred'Yuan Fu2022-12-261-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I realized that using an arbitrary function as the predicate in queries is very helpful for some queries I'm writing for python and javascript, and presumably most other languages[1]. Granted, we can already filter out unwanted nodes by using a function instead of a face for the capture name, and (1) determine whether the captured node is valid and (2) fontify that node if it's valid. However, such approach is a bit more cumbersome and more importantly gets in the way of another potential use of the fontification queries: context extraction. For example, I could use the query for the 'variable' feature to get all the variables in a certain region. In this use-case, we want the filtering happen before returning the captured nodes. Besides, the change is relatively small and straightforward: most code are already there, I just need to add some boilerplate. [1] For a code like aa.bb(cc), we want bb to be in function face, because obviously its a function. But for aa.bb, we want bb to be in property face, because it's a property. In the AST, bb is always a property, the difference between the two cases is the enclosing node: in the first case, aa.bb is in a "call_expression" node, indicating that bb is used as a function (a method). So we want a predicate function that checks whether bb is used as a function or a property, and determine whether it should be in function or property face. * doc/lispref/parsing.texi (Pattern Matching): Update manual. * src/treesit.c (Ftreesit_pattern_expand): Handle :pred. (treesit_predicate_capture_name_to_node): A new function extracted from treesit_predicate_capture_name_to_text. (treesit_predicate_capture_name_to_text): Use the newly extracted function. (treesit_predicate_pred): New predicate function. (treesit_eval_predicates): Add new predicate. Also fix a bug: we want to AND the results of each predicate. * test/src/treesit-tests.el (treesit--ert-pred-last-sibling): New helper function. (treesit-query-api): Test #pred predicate.
* ; Fix tree-sitter defun testsYuan Fu2022-12-261-30/+34
| | | | | * test/src/treesit-tests.el (treesit--ert-test-defun-navigation): Change treesit--navigate-defun to treesit--navigate-thing.
* Switch to use cursor API in treesit.cYuan Fu2022-12-171-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | ts_node_parent has bugs (bug#60054), using cursor API avoids that. Tree-sitter's author might remove ts_node_parent in the future, so might as well switch to use cursors now. We are basically reimplementing some of the logic of ts_node_prev_sibling and ts_node_parent in the sibling helper and cursor helper functions. See also https://github.com/tree-sitter/tree-sitter/issues/1992 * src/treesit.c (treesit_traverse_sibling_helper) (treesit_traverse_child_helper) (treesit_traverse_match_predicate): Reimplemented to use the cursor API. (treesit_search_dfs) (treesit_search_forward): Use the new cursor helper functions. (Ftreesit_search_subtree) (Ftreesit_search_forward) (Ftreesit_induce_sparse_tree): Use cursors. * test/src/treesit-tests.el (treesit-search-subtree): New test. (treesit--ert-search-setup): New macro. (treesit-search-forward) (treesit-search-forward-named-only) (treesit-search-backward) (treesit-search-backward-named-only) (treesit-cursor-helper-with-missing-node): New tests.
* ; Fix typosStefan Kangas2022-12-131-3/+3
|
* Add improved tree-sitter navigationYuan Fu2022-12-121-0/+282
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new set of functions (and tests) should eliminate defun-navigation bugs and limitations we currently have. This commit doesn't change any existing bahavior: treesit-beginning/end-of-defun and friends are unchanged. The plan is to later switch gear and replace the current functions with the new ones introduced in this change. This is a relatively big change, but I've setup a comprehensive test, and it should fix current bugs, so I think it's ok to put it on the release branch. The gist of the new navigation is to use treesit--defuns-around to find the previous sibling defun, next sibling defun, and the parent defun, then use this information to move to previous/next beginning/end of defun in treesit--navigate-defun. I also added comprehensive testing that tests all four possible operations (prev-beg, next-beg, prev-end, next-end) starting at all possible positions (between two sibling defuns, inside a sibling defun, etc). * lisp/treesit.el (treesit-defun-type-regexp): Expand definition to allow (REGEXP . FILTER). Old functions don't support this, but it should be fine since we are soon replacing them. (treesit-defun-tactic) (treesit-defun-skipper): New variables. (treesit-default-defun-skipper) (treesit--defuns-around) (treesit--top-level-defun) (treesit--navigate-defun): New functions. * test/src/treesit-tests.el (treesit--ert-insert-and-parse-marker) (treesit--ert-collect-positions) (treesit--ert-test-defun-navigation): New helper functions. (treesit--ert-defun-navigation-python-program) (treesit--ert-defun-navigation-js-program) (treesit--ert-defun-navigation-bash-program) (treesit--ert-defun-navigation-nested-master): New variables. (treesit-defun-navigation-nested-1) (treesit-defun-navigation-nested-2) (treesit-defun-navigation-nested-3) (treesit-defun-navigation-top-level): New tests.
* ; * test/src/treesit-tests.el: Add outline headers.Yuan Fu2022-12-121-0/+13
|
* Make indirect buffers use tree-sitter parsers of their base bufferYuan Fu2022-12-091-0/+34
| | | | | | | | | | | | Fix the problem described in bug#59693. * src/treesit.c (treesit_record_change): Always use the base buffer. (Ftreesit_parser_create): Always use the base buffer. Also change the for loop into FOR_EACH_TAIL (stylistic change). (Ftreesit_parser_list): Always use the base buffer. * doc/lispref/parsing.texi (Using Parser): Update manual. * test/src/treesit-tests.el (treesit-indirect-buffer): New test.
* Improve parameter checking in tree-sitter functionsYuan Fu2022-12-071-0/+8
| | | | | | | | | | | | | * src/treesit.c (treesit_check_position): Extract out new function. (Ftreesit_node_first_child_for_pos) (Ftreesit_node_descendant_for_range): Replace code with the new function. (Ftreesit_query_capture): Add missing check for node and parser. Add check for range for BEG and END. Move treesit_initialize to the beginning of the function. * test/src/treesit-tests.el (treesit-node-api) (treesit-query-api): Add tests for out-of-range error.
* * test/src/sqlite-tests.el (sqlite-version): Declare.Mattias Engdegård2022-12-071-0/+1
|
* Add sqlite library version string retrieval function (bug#58766)Mattias Engdegård2022-11-251-0/+1
| | | | | | | | | | * src/sqlite.c (sqlite3_libversion, load_dll_functions): Make sqlite3_libversion available. (Fsqlite_version): New. (syms_of_sqlite): Define sqlite-version. * doc/lispref/text.texi (Database): Document. * test/src/sqlite-tests.el (sqlite-returning): `RETURNING` was added in sqlite 3.35; skip the test for older versions.
* ; Fix warnings in builds without tree-sitterMattias Engdegård2022-11-221-17/+47
|
* ; * test/src/treesit-tests.el (treesit-misc): Remove test.Yuan Fu2022-11-211-21/+0
| | | | | This test is for treesit--setting-for-mode, which is removed when we switched from using treesit-settings to using separate major modes.
* Merge remote-tracking branch 'savannah/master' into feature/tree-sitterYuan Fu2022-11-2111-148/+6975
|\