diff options
| author | Eli Zaretskii | 2023-12-16 09:17:51 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2023-12-16 09:17:51 -0500 |
| commit | a1d3862c6240805bde997bb57f60fceb0fbccb85 (patch) | |
| tree | 3f0a8b9a8b7bd132336945aaad085afb185baffd /test/lisp | |
| parent | 47b10d062df643da6ecc6fc3b6b1cbb668eebb39 (diff) | |
| parent | bf4ccb0be076d8b65498c56dedf0eee17cb3c24c (diff) | |
| download | emacs-a1d3862c6240805bde997bb57f60fceb0fbccb85.tar.gz emacs-a1d3862c6240805bde997bb57f60fceb0fbccb85.zip | |
Merge from origin/emacs-29
bf4ccb0be07 ; * lisp/term.el (term--xterm-paste): Fix last change.
0d9e2e448d9 ; * doc/lispref/functions.texi (Function Documentation): ...
791cc5065da Fix shaping of Sinhala text
efcbf0b5abf Add use cases of (fn) documentation facility.
c3331cb3659 Fix pasting into terminal-mode on term.el
5be94e2bce5 Fix opening directory trees from Filesets menu
6b6e770a1f5 Eglot: Add ruff-lsp as an alternative Python server
ed8a8a5ba16 Fix symbol name in Multisession Variables examples
400ef15bdc3 js-ts-mode: Fix font-lock rules conflict
c165247c300 Add indentation rules for bracketless statements in js-ts...
7f1bd69cd19 Fix c-ts-mode bracketless indentation for BSD style (bug#...
e23068cb9a1 Add missing indent rules in c-ts-mode (bug#66152)
d2c4b926ac2 Fix treesit-default-defun-skipper (bug#66711)
9874561f39e Fix treesit-node-field-name and friends (bug#66674)
eace9e11226 python-ts-mode: Highlight default parameters
23c06c7c308 Update to Org 9.6.13
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts | 34 | ||||
| -rw-r--r-- | test/lisp/progmodes/js-resources/js-ts-indents.erts | 44 | ||||
| -rw-r--r-- | test/lisp/progmodes/js-tests.el | 6 |
3 files changed, 84 insertions, 0 deletions
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts index 74e34fe821b..fa65ba83a69 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts | |||
| @@ -91,3 +91,37 @@ main (int argc, | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | =-=-= | 93 | =-=-= |
| 94 | |||
| 95 | Name: Bracketless Simple Statement (bug#66152) | ||
| 96 | |||
| 97 | =-= | ||
| 98 | for (int i = 0; i < 5; i++) | ||
| 99 | continue; | ||
| 100 | |||
| 101 | while (true) | ||
| 102 | return 1; | ||
| 103 | |||
| 104 | do | ||
| 105 | i++; | ||
| 106 | while (true) | ||
| 107 | |||
| 108 | if (true) | ||
| 109 | break; | ||
| 110 | else | ||
| 111 | break; | ||
| 112 | =-= | ||
| 113 | for (int i = 0; i < 5; i++) | ||
| 114 | continue; | ||
| 115 | |||
| 116 | while (true) | ||
| 117 | return 1; | ||
| 118 | |||
| 119 | do | ||
| 120 | i++; | ||
| 121 | while (true) | ||
| 122 | |||
| 123 | if (true) | ||
| 124 | break; | ||
| 125 | else | ||
| 126 | break; | ||
| 127 | =-=-= | ||
diff --git a/test/lisp/progmodes/js-resources/js-ts-indents.erts b/test/lisp/progmodes/js-resources/js-ts-indents.erts new file mode 100644 index 00000000000..2e34b23acef --- /dev/null +++ b/test/lisp/progmodes/js-resources/js-ts-indents.erts | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | Code: | ||
| 2 | (lambda () | ||
| 3 | (setq indent-tabs-mode nil) | ||
| 4 | (setq js-indent-level 2) | ||
| 5 | (js-ts-mode) | ||
| 6 | (indent-region (point-min) (point-max))) | ||
| 7 | |||
| 8 | Name: Basic indentation | ||
| 9 | |||
| 10 | =-= | ||
| 11 | const foo = () => { | ||
| 12 | console.log("bar"); | ||
| 13 | if (x) { | ||
| 14 | return y; | ||
| 15 | } else if (y) { | ||
| 16 | return u; | ||
| 17 | } | ||
| 18 | return baz.x() | ||
| 19 | ? true | ||
| 20 | : false; | ||
| 21 | } | ||
| 22 | =-=-= | ||
| 23 | |||
| 24 | Name: Statement indentation without braces | ||
| 25 | |||
| 26 | =-= | ||
| 27 | function bracketless_statements(x) { | ||
| 28 | if (x == 0) | ||
| 29 | console.log("if_statement"); | ||
| 30 | else if (x == 1) | ||
| 31 | console.log("if_statement"); | ||
| 32 | else | ||
| 33 | console.log("else_clause"); | ||
| 34 | for (let i = 0; i < 1; i++) | ||
| 35 | console.log("for_statement"); | ||
| 36 | for (let _ of [true]) | ||
| 37 | console.log("for_in_statement"); | ||
| 38 | while (x-- > 0) | ||
| 39 | console.log("while_statement"); | ||
| 40 | do | ||
| 41 | console.log("do_statement"); | ||
| 42 | while (false) | ||
| 43 | }; | ||
| 44 | =-=-= | ||
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 5db92b08f8a..827d7bb8a99 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el | |||
| @@ -288,6 +288,12 @@ function bar() { | |||
| 288 | ;; end-of-defun should move point to eob. | 288 | ;; end-of-defun should move point to eob. |
| 289 | (should (eobp)))) | 289 | (should (eobp)))) |
| 290 | 290 | ||
| 291 | ;;;; Tree-sitter tests. | ||
| 292 | |||
| 293 | (ert-deftest js-ts-mode-test-indentation () | ||
| 294 | (skip-unless (treesit-ready-p 'javascript)) | ||
| 295 | (ert-test-erts-file (ert-resource-file "js-ts-indents.erts"))) | ||
| 296 | |||
| 291 | (provide 'js-tests) | 297 | (provide 'js-tests) |
| 292 | 298 | ||
| 293 | ;;; js-tests.el ends here | 299 | ;;; js-tests.el ends here |