Skip to content

Commit 73a1e96

Browse files
committed
提交测试
1 parent cfb0d0d commit 73a1e96

File tree

3 files changed

+42
-33
lines changed

3 files changed

+42
-33
lines changed

Test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ target_sources(CodeFormatTest
1919
target_link_libraries(CodeFormatTest CodeService Util)
2020

2121
add_test(NAME GrammarTest COMMAND CodeFormatTest CheckGrammar -w ${CodeFormatTest_SOURCE_DIR}/test_script/grammar)
22-
add_test(NAME FormatTest COMMAND CodeFormatTest CheckFormat -w ${CodeFormatTest_SOURCE_DIR}/test_script/format_text -f ${CodeFormatTest_SOURCE_DIR}/test_script/format_text_shouldbe)
22+
add_test(NAME FormatTest COMMAND CodeFormatTest CheckFormatResult -w ${CodeFormatTest_SOURCE_DIR}/test_script/format_text -f ${CodeFormatTest_SOURCE_DIR}/test_script/format_text_shouldbe)

Test/test_script/format_text_shouldbe/base.lua

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
--local
22
local requireA = require "aaa.bbb.ccc"
33

4-
local ccc = aaa + bbbb
5-
local ddd = aaa + eee
6-
+ eeee
7-
8-
local f = function() end
9-
local cc2 = function()
10-
end
11-
--do
12-
--local
13-
local requireA = require "aaa.bbb.ccc"
14-
154
local ccc = aaa + bbbb
165
local ddd = aaa + eee
176
+ eeee

docs/format_config.md

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ local cc = {
220220

221221
## align_table_field_to_first_field
222222

223-
该选项表示表的表项是否对齐到首个表项,选项默认值为true,格式化效果如下:
223+
该选项表示表的表项是否对齐到首个表项,选项默认值为true。
224+
225+
格式化前:
226+
224227
```lua
225-
-- 格式化前
228+
226229
local t = {
227230
aaa,bbbb,ccc,
228231
ddd,eee,fff
@@ -231,9 +234,13 @@ local t = {
231234
local t2 = {aaa,bbbb,
232235
ccc,eee
233236
}
237+
```
234238

239+
格式化后:
240+
241+
```lua
235242

236-
-- 该选项为true
243+
-- = true
237244
local t = {
238245
aaa, bbbb, ccc,
239246
ddd, eee, fff
@@ -242,7 +249,7 @@ local t2 = { aaa, bbbb,
242249
ccc, eee
243250
}
244251

245-
-- 该选项为false
252+
-- false
246253
local t = {
247254
aaa, bbbb, ccc,
248255
ddd, eee, fff
@@ -254,60 +261,73 @@ local t2 = { aaa, bbbb,
254261

255262
## continuous_assign_statement_align_to_equal_sign
256263

257-
该选项表示连续赋值语句的首行语句如果等号与左边符号相距大于一个空格,则对齐到连续赋值语句的等号最大的位置,该选项默认值为true,效果如下:
264+
该选项表示连续赋值语句的首行语句如果等号与左边符号相距大于一个空格,则对齐到连续赋值语句的等号最大的位置,该选项默认值为true.
265+
266+
格式化前:
267+
258268
```lua
259-
-- 格式化前
269+
260270
local t = 123
261271
local cccc = 456
262272
cccc = 321
263-
-- 这是个注释
264-
eeeeeeeee = 654 -- 这也是个注释
273+
-- this is a comment
274+
eeeeeeeee = 654 -- this is a comment2
265275

266276

267-
--不连续了
277+
-- no continuous
268278
local c =132
279+
```
269280

270-
-- 选项为true时
281+
格式化后:
282+
283+
```lua
284+
-- true
271285
local t = 123
272286
local cccc = 456
273287
cccc = 321
274-
-- 这是个注释
275-
eeeeeeeee = 654 -- 这也是个注释
288+
-- this is a comment
289+
eeeeeeeee = 654 -- this is a comment2
276290

277291

278-
--不连续了
292+
-- no continuous
279293
local c = 132
280294

281-
-- 选项为false时
295+
-- false
282296
local t = 123
283297
local cccc = 456
284298
cccc = 321
285-
-- 这是个注释
286-
eeeeeeeee = 654 -- 这也是个注释
299+
-- this is a comment
300+
eeeeeeeee = 654 -- this is a comment2
287301

288302

289-
--不连续了
303+
-- no continuous
290304
local c = 132
291305
```
292306

293307
## continuous_assign_table_field_align_to_equal_sign
294308

295-
该选项表示表中各项是否允许对齐到等号,对齐的规则和上面的选项近似,选项默认值为true,格式化效果如下:
309+
该选项表示表中各项是否允许对齐到等号,对齐的规则和上面的选项近似,选项默认值为true
310+
311+
格式化前:
312+
296313
```lua
297-
-- 格式化前
298314
local t = {
299315
aadddd = 123,
300316
bbb =456,
301317
ddd =789
302318
}
319+
```
320+
321+
格式化:
303322

304-
-- 选项为true时
323+
```lua
324+
-- true
305325
local t = {
306326
aadddd = 123,
307327
bbb = 456,
308328
ddd = 789
309329
}
310-
-- 选项为false时
330+
-- false
311331
local t = {
312332
aadddd = 123,
313333
bbb = 456,

0 commit comments

Comments
 (0)