forked from LuaLS/lua-language-server
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.lua
More file actions
Latest commit
115 lines (95 loc) · 2.53 KB
/
Copy pathtest.lua
File metadata and controls
115 lines (95 loc) · 2.53 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package.path=package.path
..';./test/?.lua'
..';./test/?/init.lua'
localfs=require'bee.filesystem'
localrootPath=fs.exe_path():parent_path():parent_path():string()
ROOT=fs.path(rootPath)
TEST=true
DEVELOP=true
--FOOTPRINT = true
--TRACE = true
LOGPATH=LOGPATHor (ROOT:string() ..'/log')
METAPATH=METAPATHor (ROOT:string() ..'/meta')
collectgarbage'generational'
---@diagnosticdisable-next-line:duplicate-set-field
io.write=function () end
---@diagnosticdisable-next-line:lowercase-global
log=require'log'
log.init(ROOT, ROOT/'log' /'test.log')
log.debug('测试开始')
LOCALE='zh-cn'
--dofile((ROOT / 'build_package.lua'):string())
require'tracy'
localfunctionloadAllLibs()
assert(require'bee.filesystem')
assert(require'bee.subprocess')
assert(require'bee.thread')
assert(require'bee.socket')
assert(require'lpeglabel')
end
localfunctiontest(name)
localclock=os.clock()
print(('测试[%s]...'):format(name))
localoriginRequire=require
require=function (n)
localv, p=originRequire(n)
ifpandp:find'test/' then
package.loaded[n] =nil
end
returnv, p
end
require(name)
require=originRequire
print(('测试[%s]用时[%.3f]'):format(name, os.clock() -clock))
end
localfunctiontestAll()
test'basic'
test'definition'
test'type_inference'
test'references'
test'hover'
test'completion'
test'diagnostics'
test'crossfile'
test'highlight'
test'rename'
test'signature'
test'command'
test'document_symbol'
test'code_action'
test'type_formatting'
test'other'
end
localfiles=require"files"
localfunctionmain()
require'utility'.enableCloseFunction()
require'client' .client'VSCode'
locallclient=require'lclient'
localws=require'workspace'
localfuri=require'file-uri'
require'vm'
--log.print = true
TESTURI=furi.encode('/unittest.lua')
---@async
lclient():start(function (client)
client:registerFakers()
localrootUri=furi.encode'/'
client:initialize {
rootUri=rootUri,
}
ws.awaitReady(rootUri)
print('Loaded files in', os)
foruriinfiles.eachFile() do
print(uri)
end
print('===============')
testAll()
end)
test'tclient'
test'full'
end
loadAllLibs()
main()
log.debug('test finish.')
require'bee.thread'.sleep(1)
os.exit()