diff options
| author | bug-gnu-emacs@gnu.org | 2023-09-11 10:03:13 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2023-09-16 13:01:43 +0300 |
| commit | b6659e98a4fcaa44477b64d7782243feca020418 (patch) | |
| tree | e1d3617bba53898349f50652c4c028b09af274dd /test | |
| parent | 2ea98ea35c82da31ef419da3b49789ab750e8e00 (diff) | |
| download | emacs-b6659e98a4fcaa44477b64d7782243feca020418.tar.gz emacs-b6659e98a4fcaa44477b64d7782243feca020418.zip | |
bug#65673: Add lua-ts-mode
* lisp/progmodes/lua-ts-mode.el:
* test/lisp/progmodes/lua-ts-mode-resources/indent.erts:
* test/lisp/progmodes/lua-ts-mode-tests.el: New files.
* etc/NEWS: Mention the new mode.
* lisp/progmodes/eglot.el (eglot-server-programs):
* lisp/progmodes/hideshow.el (hs-special-modes-alist):
Support 'lua-ts-mode'.
* admin/notes/tree-sitter/build-module/batch.sh:
* admin/notes/tree-sitter/build-module/build.sh: Add Lua.
* test/infra/Dockerfile.emba:
* test/infra/test-jobs.yml: Include lua-ts-mode tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/infra/Dockerfile.emba | 1 | ||||
| -rw-r--r-- | test/infra/test-jobs.yml | 1 | ||||
| -rw-r--r-- | test/lisp/progmodes/lua-ts-mode-resources/indent.erts | 152 | ||||
| -rw-r--r-- | test/lisp/progmodes/lua-ts-mode-resources/movement.erts | 553 | ||||
| -rw-r--r-- | test/lisp/progmodes/lua-ts-mode-tests.el | 36 |
5 files changed, 743 insertions, 0 deletions
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 584e4444dc1..e29098ec270 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba | |||
| @@ -126,6 +126,7 @@ RUN src/emacs -Q --batch \ | |||
| 126 | (java "https://github.com/tree-sitter/tree-sitter-java") \ | 126 | (java "https://github.com/tree-sitter/tree-sitter-java") \ |
| 127 | (javascript "https://github.com/tree-sitter/tree-sitter-javascript") \ | 127 | (javascript "https://github.com/tree-sitter/tree-sitter-javascript") \ |
| 128 | (json "https://github.com/tree-sitter/tree-sitter-json") \ | 128 | (json "https://github.com/tree-sitter/tree-sitter-json") \ |
| 129 | (lua "https://github.com/MunifTanjim/tree-sitter-lua") \ | ||
| 129 | (python "https://github.com/tree-sitter/tree-sitter-python") \ | 130 | (python "https://github.com/tree-sitter/tree-sitter-python") \ |
| 130 | (ruby "https://github.com/tree-sitter/tree-sitter-ruby") \ | 131 | (ruby "https://github.com/tree-sitter/tree-sitter-ruby") \ |
| 131 | (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") \ | 132 | (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") \ |
diff --git a/test/infra/test-jobs.yml b/test/infra/test-jobs.yml index 2f6e0dab4d5..1f5d607eda4 100644 --- a/test/infra/test-jobs.yml +++ b/test/infra/test-jobs.yml | |||
| @@ -580,6 +580,7 @@ test-src-inotify: | |||
| 580 | lisp/progmodes/go-ts-mode-tests.log | 580 | lisp/progmodes/go-ts-mode-tests.log |
| 581 | lisp/progmodes/heex-ts-mode-tests.log | 581 | lisp/progmodes/heex-ts-mode-tests.log |
| 582 | lisp/progmodes/java-ts-mode-tests.log | 582 | lisp/progmodes/java-ts-mode-tests.log |
| 583 | lisp/progmodes/lua-ts-mode-tests.log | ||
| 583 | lisp/progmodes/ruby-ts-mode-tests.log | 584 | lisp/progmodes/ruby-ts-mode-tests.log |
| 584 | lisp/progmodes/typescript-ts-mode-tests.log | 585 | lisp/progmodes/typescript-ts-mode-tests.log |
| 585 | src/treesit-tests.log | 586 | src/treesit-tests.log |
diff --git a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts new file mode 100644 index 00000000000..040225c8580 --- /dev/null +++ b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | Code: | ||
| 2 | (lambda () | ||
| 3 | (setq indent-tabs-mode nil) | ||
| 4 | (setq lua-ts-indent-offset 2) | ||
| 5 | (lua-ts-mode) | ||
| 6 | (indent-region (point-min) (point-max))) | ||
| 7 | |||
| 8 | Name: Basic Indent | ||
| 9 | |||
| 10 | =-= | ||
| 11 | print( | ||
| 12 | 0, | ||
| 13 | 1 | ||
| 14 | ) | ||
| 15 | |||
| 16 | local function f(o) | ||
| 17 | if o.x > o.y then | ||
| 18 | return o.x | ||
| 19 | elseif o.y > o.z then | ||
| 20 | return o.y | ||
| 21 | else | ||
| 22 | return o.z | ||
| 23 | end | ||
| 24 | end | ||
| 25 | |||
| 26 | f({ | ||
| 27 | x = 1, | ||
| 28 | y = 2, | ||
| 29 | z = 3, | ||
| 30 | }) | ||
| 31 | |||
| 32 | ;(function() | ||
| 33 | return false | ||
| 34 | )() | ||
| 35 | =-= | ||
| 36 | print( | ||
| 37 | 0, | ||
| 38 | 1 | ||
| 39 | ) | ||
| 40 | |||
| 41 | local function f(o) | ||
| 42 | if o.x > o.y then | ||
| 43 | return o.x | ||
| 44 | elseif o.y > o.z then | ||
| 45 | return o.y | ||
| 46 | else | ||
| 47 | return o.z | ||
| 48 | end | ||
| 49 | end | ||
| 50 | |||
| 51 | f({ | ||
| 52 | x = 1, | ||
| 53 | y = 2, | ||
| 54 | z = 3, | ||
| 55 | }) | ||
| 56 | |||
| 57 | ;(function() | ||
| 58 | return false | ||
| 59 | )() | ||
| 60 | =-=-= | ||
| 61 | |||
| 62 | Name: Argument Indent | ||
| 63 | |||
| 64 | =-= | ||
| 65 | function h( | ||
| 66 | string, | ||
| 67 | number, | ||
| 68 | options) | ||
| 69 | print(string, number, options) | ||
| 70 | end | ||
| 71 | |||
| 72 | local p = h( | ||
| 73 | "sring", | ||
| 74 | 1000, | ||
| 75 | { | ||
| 76 | cost = 2, | ||
| 77 | length = 8, | ||
| 78 | parallelism = 4, | ||
| 79 | }) | ||
| 80 | =-= | ||
| 81 | function h( | ||
| 82 | string, | ||
| 83 | number, | ||
| 84 | options) | ||
| 85 | print(string, number, options) | ||
| 86 | end | ||
| 87 | |||
| 88 | local p = h( | ||
| 89 | "sring", | ||
| 90 | 1000, | ||
| 91 | { | ||
| 92 | cost = 2, | ||
| 93 | length = 8, | ||
| 94 | parallelism = 4, | ||
| 95 | }) | ||
| 96 | =-=-= | ||
| 97 | |||
| 98 | Name: Continuation Indent | ||
| 99 | |||
| 100 | =-= | ||
| 101 | function f() | ||
| 102 | local str = [[ | ||
| 103 | multi-line | ||
| 104 | string | ||
| 105 | ]] | ||
| 106 | --[[ | ||
| 107 | multi-line | ||
| 108 | comment | ||
| 109 | ]] | ||
| 110 | return true | ||
| 111 | end | ||
| 112 | =-= | ||
| 113 | function f() | ||
| 114 | local str = [[ | ||
| 115 | multi-line | ||
| 116 | string | ||
| 117 | ]] | ||
| 118 | --[[ | ||
| 119 | multi-line | ||
| 120 | comment | ||
| 121 | ]] | ||
| 122 | return true | ||
| 123 | end | ||
| 124 | =-=-= | ||
| 125 | |||
| 126 | Name: Loop Indent | ||
| 127 | |||
| 128 | =-= | ||
| 129 | for k, v in pairs({}) do | ||
| 130 | print(k, v) | ||
| 131 | end | ||
| 132 | |||
| 133 | while n < 10 do | ||
| 134 | n = n + 1 | ||
| 135 | end | ||
| 136 | |||
| 137 | repeat | ||
| 138 | z = z * 2 | ||
| 139 | until z > 12 | ||
| 140 | =-= | ||
| 141 | for k, v in pairs({}) do | ||
| 142 | print(k, v) | ||
| 143 | end | ||
| 144 | |||
| 145 | while n < 10 do | ||
| 146 | n = n + 1 | ||
| 147 | end | ||
| 148 | |||
| 149 | repeat | ||
| 150 | z = z * 2 | ||
| 151 | until z > 12 | ||
| 152 | =-=-= | ||
diff --git a/test/lisp/progmodes/lua-ts-mode-resources/movement.erts b/test/lisp/progmodes/lua-ts-mode-resources/movement.erts new file mode 100644 index 00000000000..770aa23b18d --- /dev/null +++ b/test/lisp/progmodes/lua-ts-mode-resources/movement.erts | |||
| @@ -0,0 +1,553 @@ | |||
| 1 | Code: | ||
| 2 | (lambda () | ||
| 3 | (lua-ts-mode) | ||
| 4 | (beginning-of-defun 1)) | ||
| 5 | |||
| 6 | Point-Char: | | ||
| 7 | |||
| 8 | Name: beginning-of-defun moves to start of function declaration | ||
| 9 | |||
| 10 | =-= | ||
| 11 | local function Test() | ||
| 12 | if true then | ||
| 13 | print(1) | ||
| 14 | else | ||
| 15 | print(0) | ||
| 16 | end| | ||
| 17 | end | ||
| 18 | =-= | ||
| 19 | |local function Test() | ||
| 20 | if true then | ||
| 21 | print(1) | ||
| 22 | else | ||
| 23 | print(0) | ||
| 24 | end | ||
| 25 | end | ||
| 26 | =-=-= | ||
| 27 | |||
| 28 | Name: beginning-of-defun moves to start of function definition | ||
| 29 | |||
| 30 | =-= | ||
| 31 | local t = { | ||
| 32 | f = function() | ||
| 33 | return true | ||
| 34 | end, | ||
| 35 | }| | ||
| 36 | =-= | ||
| 37 | local t = { | ||
| 38 | | f = function() | ||
| 39 | return true | ||
| 40 | end, | ||
| 41 | } | ||
| 42 | =-=-= | ||
| 43 | |||
| 44 | Code: | ||
| 45 | (lambda () | ||
| 46 | (lua-ts-mode) | ||
| 47 | (end-of-defun 1)) | ||
| 48 | |||
| 49 | Point-Char: | | ||
| 50 | |||
| 51 | Name: end-of-defun moves to end of function declaration | ||
| 52 | |||
| 53 | =-= | ||
| 54 | local function Test() | ||
| 55 | if true then | ||
| 56 | pr|int(1) | ||
| 57 | else | ||
| 58 | print(0) | ||
| 59 | end | ||
| 60 | end | ||
| 61 | |||
| 62 | local t = Test() | ||
| 63 | =-= | ||
| 64 | local function Test() | ||
| 65 | if true then | ||
| 66 | print(1) | ||
| 67 | else | ||
| 68 | print(0) | ||
| 69 | end | ||
| 70 | end | ||
| 71 | | | ||
| 72 | local t = Test() | ||
| 73 | =-=-= | ||
| 74 | |||
| 75 | Name: end-of-defun moves to end of function definition | ||
| 76 | |||
| 77 | =-= | ||
| 78 | local t = { | ||
| 79 | f = function() | ||
| 80 | re|turn true | ||
| 81 | end, | ||
| 82 | } | ||
| 83 | =-= | ||
| 84 | local t = { | ||
| 85 | f = function() | ||
| 86 | return true | ||
| 87 | end|, | ||
| 88 | } | ||
| 89 | =-=-= | ||
| 90 | |||
| 91 | Code: | ||
| 92 | (lambda () | ||
| 93 | (lua-ts-mode) | ||
| 94 | (forward-sentence 1)) | ||
| 95 | |||
| 96 | Point-Char: | | ||
| 97 | |||
| 98 | Name: forward-sentence moves over if statements | ||
| 99 | |||
| 100 | =-= | ||
| 101 | function f() | ||
| 102 | |if true then | ||
| 103 | print(1) | ||
| 104 | elseif false then | ||
| 105 | print(0) | ||
| 106 | else | ||
| 107 | print(2) | ||
| 108 | end | ||
| 109 | end | ||
| 110 | =-= | ||
| 111 | function f() | ||
| 112 | if true then | ||
| 113 | print(1) | ||
| 114 | elseif false then | ||
| 115 | print(0) | ||
| 116 | else | ||
| 117 | print(2) | ||
| 118 | end| | ||
| 119 | end | ||
| 120 | =-=-= | ||
| 121 | |||
| 122 | Name: forward-sentence moves over variable declaration | ||
| 123 | |||
| 124 | =-= | ||
| 125 | |local n = 1 | ||
| 126 | |||
| 127 | print(n) | ||
| 128 | =-= | ||
| 129 | local n = 1| | ||
| 130 | |||
| 131 | print(n) | ||
| 132 | =-=-= | ||
| 133 | |||
| 134 | Name: forward-sentence moves over for statements | ||
| 135 | |||
| 136 | =-= | ||
| 137 | |for k, v in pairs({}) do | ||
| 138 | print(k, v) | ||
| 139 | end | ||
| 140 | |||
| 141 | print(1) | ||
| 142 | =-= | ||
| 143 | for k, v in pairs({}) do | ||
| 144 | print(k, v) | ||
| 145 | end| | ||
| 146 | |||
| 147 | print(1) | ||
| 148 | =-=-= | ||
| 149 | |||
| 150 | Name: forward-sentence moves over for statements | ||
| 151 | |||
| 152 | =-= | ||
| 153 | |do | ||
| 154 | local x = 1 | ||
| 155 | local y = 2 | ||
| 156 | |||
| 157 | print(x, y) | ||
| 158 | end | ||
| 159 | |||
| 160 | print(1) | ||
| 161 | =-= | ||
| 162 | do | ||
| 163 | local x = 1 | ||
| 164 | local y = 2 | ||
| 165 | |||
| 166 | print(x, y) | ||
| 167 | end| | ||
| 168 | |||
| 169 | print(1) | ||
| 170 | =-=-= | ||
| 171 | |||
| 172 | Name: forward-sentence moves over while statements | ||
| 173 | |||
| 174 | =-= | ||
| 175 | local i = 0 | ||
| 176 | |while i < 9 do | ||
| 177 | print(i) | ||
| 178 | i = i + 1 | ||
| 179 | end | ||
| 180 | |||
| 181 | print(1) | ||
| 182 | =-= | ||
| 183 | local i = 0 | ||
| 184 | while i < 9 do | ||
| 185 | print(i) | ||
| 186 | i = i + 1 | ||
| 187 | end| | ||
| 188 | |||
| 189 | print(1) | ||
| 190 | =-=-= | ||
| 191 | |||
| 192 | Name: forward-sentence moves over repeat statements | ||
| 193 | |||
| 194 | =-= | ||
| 195 | local i = 0 | ||
| 196 | |repeat | ||
| 197 | print(i) | ||
| 198 | i = i + 1 | ||
| 199 | until i > 9 | ||
| 200 | |||
| 201 | print(1) | ||
| 202 | =-= | ||
| 203 | local i = 0 | ||
| 204 | repeat | ||
| 205 | print(i) | ||
| 206 | i = i + 1 | ||
| 207 | until i > 9| | ||
| 208 | |||
| 209 | print(1) | ||
| 210 | =-=-= | ||
| 211 | |||
| 212 | Name: forward-sentence moves over function calls | ||
| 213 | |||
| 214 | =-= | ||
| 215 | |print(1) | ||
| 216 | =-= | ||
| 217 | print(1)| | ||
| 218 | =-=-= | ||
| 219 | |||
| 220 | Name: forward-sentence moves over return statements | ||
| 221 | |||
| 222 | =-= | ||
| 223 | function f() | ||
| 224 | |return math.random() | ||
| 225 | end | ||
| 226 | =-= | ||
| 227 | function f() | ||
| 228 | return math.random()| | ||
| 229 | end | ||
| 230 | =-=-= | ||
| 231 | |||
| 232 | Code: | ||
| 233 | (lambda () | ||
| 234 | (lua-ts-mode) | ||
| 235 | (forward-sentence 2)) | ||
| 236 | |||
| 237 | Name: forward-sentence moves over table fields | ||
| 238 | |||
| 239 | =-= | ||
| 240 | local t = { | ||
| 241 | |a = 1, | ||
| 242 | b = 2, | ||
| 243 | } | ||
| 244 | =-= | ||
| 245 | local t = { | ||
| 246 | a = 1, | ||
| 247 | b = 2|, | ||
| 248 | } | ||
| 249 | =-=-= | ||
| 250 | |||
| 251 | Code: | ||
| 252 | (lambda () | ||
| 253 | (lua-ts-mode) | ||
| 254 | (backward-sentence 1)) | ||
| 255 | |||
| 256 | Point-Char: | | ||
| 257 | |||
| 258 | Name: backward-sentence moves over if statements | ||
| 259 | |||
| 260 | =-= | ||
| 261 | function f() | ||
| 262 | if true then | ||
| 263 | print(1) | ||
| 264 | elseif false then | ||
| 265 | print(0) | ||
| 266 | else | ||
| 267 | print(2) | ||
| 268 | end| | ||
| 269 | end | ||
| 270 | =-= | ||
| 271 | function f() | ||
| 272 | |if true then | ||
| 273 | print(1) | ||
| 274 | elseif false then | ||
| 275 | print(0) | ||
| 276 | else | ||
| 277 | print(2) | ||
| 278 | end | ||
| 279 | end | ||
| 280 | =-=-= | ||
| 281 | |||
| 282 | Name: backward-sentence moves over variable declaration | ||
| 283 | |||
| 284 | =-= | ||
| 285 | local n = 1| | ||
| 286 | |||
| 287 | print(n) | ||
| 288 | =-= | ||
| 289 | |local n = 1 | ||
| 290 | |||
| 291 | print(n) | ||
| 292 | =-=-= | ||
| 293 | |||
| 294 | Name: backward-sentence moves over for statements | ||
| 295 | |||
| 296 | =-= | ||
| 297 | for k, v in pairs({}) do | ||
| 298 | print(k, v) | ||
| 299 | end| | ||
| 300 | |||
| 301 | print(1) | ||
| 302 | =-= | ||
| 303 | |for k, v in pairs({}) do | ||
| 304 | print(k, v) | ||
| 305 | end | ||
| 306 | |||
| 307 | print(1) | ||
| 308 | =-=-= | ||
| 309 | |||
| 310 | Name: backward-sentence moves over for statements | ||
| 311 | |||
| 312 | =-= | ||
| 313 | do | ||
| 314 | local x = 1 | ||
| 315 | local y = 2 | ||
| 316 | |||
| 317 | print(x, y) | ||
| 318 | end| | ||
| 319 | |||
| 320 | print(1) | ||
| 321 | =-= | ||
| 322 | |do | ||
| 323 | local x = 1 | ||
| 324 | local y = 2 | ||
| 325 | |||
| 326 | print(x, y) | ||
| 327 | end | ||
| 328 | |||
| 329 | print(1) | ||
| 330 | =-=-= | ||
| 331 | |||
| 332 | Name: backward-sentence moves over while statements | ||
| 333 | |||
| 334 | =-= | ||
| 335 | local i = 0 | ||
| 336 | while i < 9 do | ||
| 337 | print(i) | ||
| 338 | i = i + 1 | ||
| 339 | end| | ||
| 340 | |||
| 341 | print(1) | ||
| 342 | =-= | ||
| 343 | local i = 0 | ||
| 344 | |while i < 9 do | ||
| 345 | print(i) | ||
| 346 | i = i + 1 | ||
| 347 | end | ||
| 348 | |||
| 349 | print(1) | ||
| 350 | =-=-= | ||
| 351 | |||
| 352 | Name: backward-sentence moves over repeat statements | ||
| 353 | |||
| 354 | =-= | ||
| 355 | local i = 0 | ||
| 356 | repeat | ||
| 357 | print(i) | ||
| 358 | i = i + 1 | ||
| 359 | until i > 9| | ||
| 360 | |||
| 361 | print(1) | ||
| 362 | =-= | ||
| 363 | local i = 0 | ||
| 364 | |repeat | ||
| 365 | print(i) | ||
| 366 | i = i + 1 | ||
| 367 | until i > 9 | ||
| 368 | |||
| 369 | print(1) | ||
| 370 | =-=-= | ||
| 371 | |||
| 372 | Name: backward-sentence moves over function calls | ||
| 373 | |||
| 374 | =-= | ||
| 375 | print(1)| | ||
| 376 | =-= | ||
| 377 | |print(1) | ||
| 378 | =-=-= | ||
| 379 | |||
| 380 | Name: backward-sentence moves over return statements | ||
| 381 | |||
| 382 | =-= | ||
| 383 | function f() | ||
| 384 | return math.random()| | ||
| 385 | end | ||
| 386 | =-= | ||
| 387 | function f() | ||
| 388 | |return math.random() | ||
| 389 | end | ||
| 390 | =-=-= | ||
| 391 | |||
| 392 | Code: | ||
| 393 | (lambda () | ||
| 394 | (lua-ts-mode) | ||
| 395 | (backward-sentence 2)) | ||
| 396 | |||
| 397 | Point-Char: | | ||
| 398 | |||
| 399 | Name: backward-sentence moves over table fields | ||
| 400 | |||
| 401 | =-= | ||
| 402 | local t = { | ||
| 403 | a = 1, | ||
| 404 | b = 2|, | ||
| 405 | } | ||
| 406 | =-= | ||
| 407 | local t = { | ||
| 408 | |a = 1, | ||
| 409 | b = 2, | ||
| 410 | } | ||
| 411 | =-=-= | ||
| 412 | |||
| 413 | Code: | ||
| 414 | (lambda () | ||
| 415 | (lua-ts-mode) | ||
| 416 | (forward-sexp 1)) | ||
| 417 | |||
| 418 | Point-Char: | | ||
| 419 | |||
| 420 | Name: forward-sexp moves over blocks | ||
| 421 | |||
| 422 | =-= | ||
| 423 | local function Test() | ||
| 424 | |local t = { | ||
| 425 | a = 1, | ||
| 426 | } | ||
| 427 | |||
| 428 | if true then | ||
| 429 | print(1) | ||
| 430 | else | ||
| 431 | print(0) | ||
| 432 | end | ||
| 433 | end | ||
| 434 | =-= | ||
| 435 | local function Test() | ||
| 436 | local t = { | ||
| 437 | a = 1, | ||
| 438 | } | ||
| 439 | |||
| 440 | if true then | ||
| 441 | print(1) | ||
| 442 | else | ||
| 443 | print(0) | ||
| 444 | end| | ||
| 445 | end | ||
| 446 | =-=-= | ||
| 447 | |||
| 448 | Name: forward-sexp moves over arguments | ||
| 449 | |||
| 450 | =-= | ||
| 451 | print|(1, 2, 3) | ||
| 452 | =-= | ||
| 453 | print(1, 2, 3)| | ||
| 454 | =-=-= | ||
| 455 | |||
| 456 | Name: forward-sexp moves over parameters | ||
| 457 | |||
| 458 | =-= | ||
| 459 | function f|(a, b) end | ||
| 460 | =-= | ||
| 461 | function f(a, b)| end | ||
| 462 | =-=-= | ||
| 463 | |||
| 464 | Name: forward-sexp moves over strings | ||
| 465 | |||
| 466 | =-= | ||
| 467 | print("|1, 2, 3") | ||
| 468 | =-= | ||
| 469 | print("1, 2, 3|") | ||
| 470 | =-=-= | ||
| 471 | |||
| 472 | Name: forward-sexp moves over tables | ||
| 473 | |||
| 474 | =-= | ||
| 475 | local t = |{ 1, | ||
| 476 | 2, | ||
| 477 | 3 } | ||
| 478 | =-= | ||
| 479 | local t = { 1, | ||
| 480 | 2, | ||
| 481 | 3 }| | ||
| 482 | =-=-= | ||
| 483 | |||
| 484 | Code: | ||
| 485 | (lambda () | ||
| 486 | (lua-ts-mode) | ||
| 487 | (backward-sexp 1)) | ||
| 488 | |||
| 489 | Point-Char: | | ||
| 490 | |||
| 491 | Name: backward-sexp moves over blocks | ||
| 492 | |||
| 493 | =-= | ||
| 494 | local function Test() | ||
| 495 | local t = { | ||
| 496 | a = 1, | ||
| 497 | } | ||
| 498 | |||
| 499 | if true then | ||
| 500 | print(1) | ||
| 501 | else | ||
| 502 | print(0) | ||
| 503 | end| | ||
| 504 | end | ||
| 505 | =-= | ||
| 506 | local function Test() | ||
| 507 | |local t = { | ||
| 508 | a = 1, | ||
| 509 | } | ||
| 510 | |||
| 511 | if true then | ||
| 512 | print(1) | ||
| 513 | else | ||
| 514 | print(0) | ||
| 515 | end | ||
| 516 | end | ||
| 517 | =-=-= | ||
| 518 | |||
| 519 | Name: backward-sexp moves over arguments | ||
| 520 | |||
| 521 | =-= | ||
| 522 | print(1, 2, 3)| | ||
| 523 | =-= | ||
| 524 | print|(1, 2, 3) | ||
| 525 | =-=-= | ||
| 526 | |||
| 527 | Name: backward-sexp moves over parameters | ||
| 528 | |||
| 529 | =-= | ||
| 530 | function f(a, b)| end | ||
| 531 | =-= | ||
| 532 | function f|(a, b) end | ||
| 533 | =-=-= | ||
| 534 | |||
| 535 | Name: backward-sexp moves over strings | ||
| 536 | |||
| 537 | =-= | ||
| 538 | print("1, 2, 3|") | ||
| 539 | =-= | ||
| 540 | print("|1, 2, 3") | ||
| 541 | =-=-= | ||
| 542 | |||
| 543 | Name: backward-sexp moves over tables | ||
| 544 | |||
| 545 | =-= | ||
| 546 | local t = { 1, | ||
| 547 | 2, | ||
| 548 | 3 }| | ||
| 549 | =-= | ||
| 550 | local t = |{ 1, | ||
| 551 | 2, | ||
| 552 | 3 } | ||
| 553 | =-=-= | ||
diff --git a/test/lisp/progmodes/lua-ts-mode-tests.el b/test/lisp/progmodes/lua-ts-mode-tests.el new file mode 100644 index 00000000000..d2105b66f6d --- /dev/null +++ b/test/lisp/progmodes/lua-ts-mode-tests.el | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | ;;; lua-ts-mode-tests.el --- Tests for lua-ts-mode -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2023 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (require 'ert) | ||
| 23 | (require 'ert-x) | ||
| 24 | (require 'treesit) | ||
| 25 | |||
| 26 | (ert-deftest lua-ts-mode-test-indentation () | ||
| 27 | (skip-unless (treesit-ready-p 'lua)) | ||
| 28 | (ert-test-erts-file (ert-resource-file "indent.erts"))) | ||
| 29 | |||
| 30 | (ert-deftest lua-ts-mode-test-movement () | ||
| 31 | (skip-unless (treesit-ready-p 'lua)) | ||
| 32 | (ert-test-erts-file (ert-resource-file "movement.erts"))) | ||
| 33 | |||
| 34 | (provide 'lua-ts-mode-tests) | ||
| 35 | |||
| 36 | ;;; lua-ts-mode-tests.el ends here | ||