summaryrefslogtreecommitdiff
path: root/server/test.lua
blob: 8a1a959691381bfcfac24bf347d6ec2e4ca11c7c (plain)
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
local currentPath = debug.getinfo(1, 'S').source:sub(2)
local rootPath = currentPath:gsub('[^/\\]-$', '')
if rootPath == '' then
    rootPath = './'
end
package.cpath = rootPath .. 'bin/?.so'
      .. ';' .. rootPath .. 'bin/?.dll'
package.path  = rootPath .. 'test/?.lua'
      .. ';' .. rootPath .. 'test/?/init.lua'
      .. ';' .. rootPath .. 'src/?.lua'
      .. ';' .. rootPath .. 'src/?/init.lua'

local fs = require 'bee.filesystem'
ROOT = fs.absolute(fs.path(rootPath):parent_path())
print('ROOT =', ROOT)
LANG = 'en-US'

log = require 'log'
log.init(ROOT, ROOT / 'log' / 'test.log')
log.debug('测试开始')
ac = {}

require 'utility'
require 'global_protect'
dofile((ROOT / 'build_package.lua'):string())

local function loadAllLibs()
    assert(require 'bee.filesystem')
    assert(require 'bee.subprocess')
    assert(require 'bee.thread')
    assert(require 'bee.socket')
    assert(require 'lni')
    assert(require 'lpeglabel')
end

local function main()
    local function test(name)
        local clock = os.clock()
        print(('测试[%s]...'):format(name))
        require(name)
        print(('测试[%s]用时[%.3f]'):format(name, os.clock() - clock))
    end

    test 'core'
    test 'definition'
    test 'rename'
    test 'highlight'
    test 'references'
    test 'diagnostics'
    test 'type_inference'
    test 'find_lib'
    test 'hover'
    test 'completion'
    test 'signature'
    test 'document_symbol'
    test 'crossfile'
    test 'full'

    print('测试完成')
end

loadAllLibs()
main()

log.debug('测试完成')