File: README.md

package info (click to toggle)
lua-mode 20250310~git.2f6b8d7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 428 kB
  • sloc: lisp: 3,186; makefile: 40; sh: 21
file content (63 lines) | stat: -rw-r--r-- 1,545 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
## Indentation Tests

This directory contains indentation tests for `lua-mode`.

Each `*.lua` file will be processed by `test-indentation.el` as follows:

- the file itself will be added as a buttercup `describe` block

- each span of code between comments will be added as `it` block that checks that the code is reindented as given in the file

- last line of comment before Lua code span will be used as the name of `it` block

- spans of code that have empty name will be called `section 1`, `section 2` and so on

- spans of code that contain only whitespace will be skipped

- if the name of the code span contains `XFAIL`, the test will be created as an expected failure (`xit` in buttercup)

### Example

Here's an example:

```lua

-- function call indentation

function(
   1,
   2,
   3,
)

-- XXX: this is commented out for now
-- while block indentation
--
-- while true do
--    print(123)
-- end
--
-- function literal indentation

local x = function()
   return 1, 2, 3
end

```

It will create two tests, "function call indentation" and "function literal" indentation. The test called "while block indentation" will be ignored completely.

### Adding Configuration Parameters

To add configuration parameters use Emacs syntax for Local Variables:

```

-- Local Variables:
-- lua-indent-close-paren-align: nil
-- lua-indent-only-use-last-opener: t
-- End:

```

This can go anywhere in the file, but make sure that the code span after the local variables section has a name comment, otherwise it will use `End:` line as a name.