aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/lua-mode-resources/font-lock.lua
diff options
context:
space:
mode:
authorjohn muhl2025-03-21 12:15:02 -0500
committerPo Lu2025-08-25 09:59:04 +0800
commitc5656af2ff5f2ee4a683540db792ccece6db4e43 (patch)
treedd0eaaab38f36e99b9613854243da73bb5a906bd /test/lisp/progmodes/lua-mode-resources/font-lock.lua
parent38a07757425c711e037c526f2c76d342a81e7c17 (diff)
downloademacs-c5656af2ff5f2ee4a683540db792ccece6db4e43.tar.gz
emacs-c5656af2ff5f2ee4a683540db792ccece6db4e43.zip
; Add tests for 'lua-mode'
* test/lisp/progmodes/lua-mode-resources/font-lock.lua: * test/lisp/progmodes/lua-mode-resources/hide-show.lua: * test/lisp/progmodes/lua-mode-resources/indent.erts: * test/lisp/progmodes/lua-mode-resources/movement.erts: * test/lisp/progmodes/lua-mode-resources/which-function.lua: * test/lisp/progmodes/lua-mode-tests.el: New file.
Diffstat (limited to 'test/lisp/progmodes/lua-mode-resources/font-lock.lua')
-rw-r--r--test/lisp/progmodes/lua-mode-resources/font-lock.lua184
1 files changed, 184 insertions, 0 deletions
diff --git a/test/lisp/progmodes/lua-mode-resources/font-lock.lua b/test/lisp/progmodes/lua-mode-resources/font-lock.lua
new file mode 100644
index 00000000000..bcf77b632c2
--- /dev/null
+++ b/test/lisp/progmodes/lua-mode-resources/font-lock.lua
@@ -0,0 +1,184 @@
1#!/usr/bin/env lua
2-- ^ font-lock-comment-face
3-- Comment
4-- <- font-lock-comment-delimiter-face
5-- ^ font-lock-comment-face
6--[[
7-- ^ font-lock-comment-face
8Multi-line comment
9-- ^ font-lock-comment-face
10]]
11-- <- font-lock-comment-face
12local line_comment = "comment" -- comment
13-- ^ font-lock-comment-face
14
15-- Definition
16local function f1() end
17-- ^ font-lock-function-name-face
18local f2 = function() end
19-- ^ font-lock-function-name-face
20local tb = { f1 = function() end }
21-- ^ font-lock-function-name-face
22function tb.f2() end
23-- ^ font-lock-function-name-face
24function tb:f3() end
25-- ^ font-lock-function-name-face
26tbl.f4 = function() end
27-- ^ font-lock-function-name-face
28function x.y:z() end
29-- ^ font-lock-function-name-face
30
31-- Keyword
32if true then
33-- <- font-lock-keyword-face
34-- ^ font-lock-keyword-face
35elseif true then
36-- <- font-lock-keyword-face
37else end
38-- <- font-lock-keyword-face
39-- ^ font-lock-keyword-face
40local p = {}
41-- ^ font-lock-keyword-face
42for k,v in pairs({}) do end
43-- <- font-lock-keyword-face
44-- ^ font-lock-keyword-face
45repeat if true then break end until false
46-- <- font-lock-keyword-face
47-- ^ font-lock-keyword-face
48-- ^ font-lock-keyword-face
49while true do end
50-- <- font-lock-keyword-face
51-- ^ font-lock-keyword-face
52function fn() return true end
53-- <- font-lock-keyword-face
54-- ^ font-lock-keyword-face
55goto label1
56-- ^ font-lock-keyword-face
57::label1::
58if true and not false or nil then
59-- ^ font-lock-keyword-face
60-- ^ font-lock-keyword-face
61-- ^ font-lock-keyword-face
62end
63
64-- String
65local _
66_ = "x"
67-- ^ font-lock-string-face
68_ = 'x'
69-- ^ font-lock-string-face
70_ = "x\ty"
71-- ^ font-lock-string-face
72-- ^ font-lock-string-face
73_ = "x\"y"
74-- ^ font-lock-string-face
75-- ^ font-lock-string-face
76_ = 'x\'y'
77-- ^ font-lock-string-face
78-- ^ font-lock-string-face
79_ = "x\z
80 y"
81-- ^ font-lock-string-face
82_ = "x\0900y"
83-- ^ font-lock-string-face
84_ = "x\09y"
85-- ^ font-lock-string-face
86_ = "x\0y"
87-- ^ font-lock-string-face
88_ = "x\u{1f602}y"
89-- ^ font-lock-string-face
90_ = [[x]]
91-- ^ font-lock-string-face
92_ = [=[x]=]
93-- ^ font-lock-string-face
94
95-- Assignment
96local n = 0
97-- ^ font-lock-variable-name-face
98for i=0,9 do end
99-- ^ font-lock-variable-name-face
100
101-- Constant
102::label2::
103-- ^ font-lock-constant-face
104goto label2
105-- ^ font-lock-constant-face
106
107-- Builtin
108assert()
109-- <- font-lock-builtin-face
110bit32()
111-- <- font-lock-builtin-face
112collectgarbage()
113-- <- font-lock-builtin-face
114coroutine()
115-- <- font-lock-builtin-face
116debug()
117-- <- font-lock-builtin-face
118dofile()
119-- <- font-lock-builtin-face
120error()
121-- <- font-lock-builtin-face
122getmetatable()
123-- <- font-lock-builtin-face
124io()
125-- <- font-lock-builtin-face
126ipairs()
127-- <- font-lock-builtin-face
128load()
129-- <- font-lock-builtin-face
130loadfile()
131-- <- font-lock-builtin-face
132math()
133-- <- font-lock-builtin-face
134next()
135-- <- font-lock-builtin-face
136os()
137-- <- font-lock-builtin-face
138package()
139-- <- font-lock-builtin-face
140pairs()
141-- <- font-lock-builtin-face
142pcall()
143-- <- font-lock-builtin-face
144print()
145-- <- font-lock-builtin-face
146rawequal()
147-- <- font-lock-builtin-face
148rawget()
149-- <- font-lock-builtin-face
150rawlen()
151-- <- font-lock-builtin-face
152rawset()
153-- <- font-lock-builtin-face
154require()
155-- <- font-lock-builtin-face
156select()
157-- <- font-lock-builtin-face
158setmetatable()
159-- <- font-lock-builtin-face
160string()
161-- <- font-lock-builtin-face
162table()
163-- <- font-lock-builtin-face
164tonumber()
165-- <- font-lock-builtin-face
166tostring()
167-- <- font-lock-builtin-face
168type()
169-- <- font-lock-builtin-face
170utf8()
171-- <- font-lock-builtin-face
172warn()
173-- <- font-lock-builtin-face
174xpcall()
175-- <- font-lock-builtin-face
176print(_G)
177-- ^ font-lock-builtin-face
178print(_VERSION)
179-- ^ font-lock-builtin-face
180
181-- Variable
182function fn(x, y) end
183-- ^ font-lock-variable-name-face
184-- ^ font-lock-variable-name-face