Skip to content

Commit 5c39b8f

Browse files
committed
fix tests
1 parent 1f1f00f commit 5c39b8f

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed

Diff for: script/file-uri.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ function m.encode(path)
4848
end
4949

5050
-- lower-case windows drive letters in /C:/fff or C:/fff
51-
local start, finish, drive = path:find '/(%u):'
52-
if drive then
53-
path = path:sub(1, start) .. drive:lower() .. path:sub(finish, -1)
54-
end
51+
-- local start, finish, drive = path:find '/(%u):'
52+
-- if drive then
53+
-- path = path:sub(1, start) .. drive:lower() .. path:sub(finish, -1)
54+
-- end
5555

5656
local uri = 'file://'
5757
.. authority:gsub(escPatt, esc)
@@ -78,7 +78,7 @@ function m.decode(uri)
7878
if scheme == 'file' and #authority > 0 and #path > 1 then
7979
value = '//' .. authority .. path
8080
elseif path:match '/%a:' then
81-
value = path:sub(2, 2):lower() .. path:sub(3)
81+
value = path:sub(2, 2) .. path:sub(3)
8282
else
8383
value = path
8484
end

Diff for: script/workspace/workspace.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ function m.findUrisByFilePath(path)
346346
local results = {}
347347
local posts = {}
348348
for uri in files.eachFile() do
349+
if platform.OS ~= 'Windows' then
350+
uri = files.getOriginUri(uri)
351+
end
349352
if not uri:find(lpath, 1, true) then
350353
goto CONTINUE
351354
end
@@ -424,9 +427,6 @@ function m.normalize(path)
424427
path = path:gsub('[/\\]+', '/')
425428
:gsub('[/\\]+$', '')
426429
end
427-
path = path:gsub('^%a+%:', function (str)
428-
return str:upper()
429-
end)
430430
return path
431431
end
432432

Diff for: test.lua

+36-16
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ local function loadDocMetas()
4444
end
4545
end
4646

47-
local function main()
48-
debug.setcstacklimit(1000)
49-
require 'core.guide'.debugMode = true
50-
require 'language' 'zh-cn'
51-
require 'utility'.enableCloseFunction()
52-
local function test(name)
53-
local clock = os.clock()
54-
print(('测试[%s]...'):format(name))
55-
require(name)
56-
print(('测试[%s]用时[%.3f]'):format(name, os.clock() - clock))
47+
local function test(name)
48+
local clock = os.clock()
49+
print(('测试[%s]...'):format(name))
50+
local originRequire = require
51+
require = function (n, ...)
52+
local v, p = originRequire(n, ...)
53+
if p and p:find 'test/' then
54+
package.loaded[n] = nil
55+
end
56+
return v, p
5757
end
58+
require(name)
59+
require = originRequire
60+
print(('测试[%s]用时[%.3f]'):format(name, os.clock() - clock))
61+
end
5862

59-
local config = require 'config'
60-
config.config.runtime.version = 'Lua 5.4'
61-
--config.config.intelliSense.searchDepth = 5
62-
loadDocMetas()
63-
63+
local function testAll()
6464
test 'basic'
6565
test 'references'
6666
test 'definition'
@@ -75,8 +75,28 @@ local function main()
7575
test 'code_action'
7676
test 'type_formatting'
7777
test 'crossfile'
78-
test 'full'
7978
--test 'other'
79+
end
80+
81+
local function main()
82+
debug.setcstacklimit(1000)
83+
require 'core.guide'.debugMode = true
84+
require 'language' 'zh-cn'
85+
require 'utility'.enableCloseFunction()
86+
87+
local config = require 'config'
88+
config.config.runtime.version = 'Lua 5.4'
89+
--config.config.intelliSense.searchDepth = 5
90+
loadDocMetas()
91+
92+
require 'bee.platform'.OS = 'Windows'
93+
testAll()
94+
require 'bee.platform'.OS = 'Linux'
95+
testAll()
96+
require 'bee.platform'.OS = 'macOS'
97+
testAll()
98+
99+
test 'full'
80100

81101
print('测试完成')
82102
end

Diff for: test/full/self.lua

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ fsu.scanDirectory(ROOT, function (path)
1515
files.open(uri)
1616
end)
1717

18-
config.config.diagnostics.disable['undefined-field'] = true
19-
config.config.diagnostics.disable['redundant-parameter'] = true
2018
diag.start()
2119

2220
local clock = os.clock()

0 commit comments

Comments
 (0)