summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-17 20:52:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-17 20:52:05 +0800
commit5c39b8fc967b1dec072d9dcd01bee4752f184044 (patch)
tree3331e16b82f0ca9af16754db14219134d9dea9b6
parent1f1f00ff531dabccd6cda3db379eab80bf8eee82 (diff)
downloadlua-language-server-5c39b8fc967b1dec072d9dcd01bee4752f184044.zip
fix tests
-rw-r--r--script/file-uri.lua10
-rw-r--r--script/workspace/workspace.lua6
-rw-r--r--test.lua52
-rw-r--r--test/full/self.lua2
4 files changed, 44 insertions, 26 deletions
diff --git a/script/file-uri.lua b/script/file-uri.lua
index d1c495b4..0749b1b9 100644
--- a/script/file-uri.lua
+++ b/script/file-uri.lua
@@ -48,10 +48,10 @@ function m.encode(path)
end
-- lower-case windows drive letters in /C:/fff or C:/fff
- local start, finish, drive = path:find '/(%u):'
- if drive then
- path = path:sub(1, start) .. drive:lower() .. path:sub(finish, -1)
- end
+ -- local start, finish, drive = path:find '/(%u):'
+ -- if drive then
+ -- path = path:sub(1, start) .. drive:lower() .. path:sub(finish, -1)
+ -- end
local uri = 'file://'
.. authority:gsub(escPatt, esc)
@@ -78,7 +78,7 @@ function m.decode(uri)
if scheme == 'file' and #authority > 0 and #path > 1 then
value = '//' .. authority .. path
elseif path:match '/%a:' then
- value = path:sub(2, 2):lower() .. path:sub(3)
+ value = path:sub(2, 2) .. path:sub(3)
else
value = path
end
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 6047d398..6d5c8034 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -346,6 +346,9 @@ function m.findUrisByFilePath(path)
local results = {}
local posts = {}
for uri in files.eachFile() do
+ if platform.OS ~= 'Windows' then
+ uri = files.getOriginUri(uri)
+ end
if not uri:find(lpath, 1, true) then
goto CONTINUE
end
@@ -424,9 +427,6 @@ function m.normalize(path)
path = path:gsub('[/\\]+', '/')
:gsub('[/\\]+$', '')
end
- path = path:gsub('^%a+%:', function (str)
- return str:upper()
- end)
return path
end
diff --git a/test.lua b/test.lua
index 5adf111f..bbc5f208 100644
--- a/test.lua
+++ b/test.lua
@@ -44,23 +44,23 @@ local function loadDocMetas()
end
end
-local function main()
- debug.setcstacklimit(1000)
- require 'core.guide'.debugMode = true
- require 'language' 'zh-cn'
- require 'utility'.enableCloseFunction()
- local function test(name)
- local clock = os.clock()
- print(('测试[%s]...'):format(name))
- require(name)
- print(('测试[%s]用时[%.3f]'):format(name, os.clock() - clock))
+local function test(name)
+ local clock = os.clock()
+ print(('测试[%s]...'):format(name))
+ local originRequire = require
+ require = function (n, ...)
+ local v, p = originRequire(n, ...)
+ if p and p:find 'test/' then
+ package.loaded[n] = nil
+ end
+ return v, p
end
+ require(name)
+ require = originRequire
+ print(('测试[%s]用时[%.3f]'):format(name, os.clock() - clock))
+end
- local config = require 'config'
- config.config.runtime.version = 'Lua 5.4'
- --config.config.intelliSense.searchDepth = 5
- loadDocMetas()
-
+local function testAll()
test 'basic'
test 'references'
test 'definition'
@@ -75,8 +75,28 @@ local function main()
test 'code_action'
test 'type_formatting'
test 'crossfile'
- test 'full'
--test 'other'
+end
+
+local function main()
+ debug.setcstacklimit(1000)
+ require 'core.guide'.debugMode = true
+ require 'language' 'zh-cn'
+ require 'utility'.enableCloseFunction()
+
+ local config = require 'config'
+ config.config.runtime.version = 'Lua 5.4'
+ --config.config.intelliSense.searchDepth = 5
+ loadDocMetas()
+
+ require 'bee.platform'.OS = 'Windows'
+ testAll()
+ require 'bee.platform'.OS = 'Linux'
+ testAll()
+ require 'bee.platform'.OS = 'macOS'
+ testAll()
+
+ test 'full'
print('测试完成')
end
diff --git a/test/full/self.lua b/test/full/self.lua
index 247702ae..7b5f04f4 100644
--- a/test/full/self.lua
+++ b/test/full/self.lua
@@ -15,8 +15,6 @@ fsu.scanDirectory(ROOT, function (path)
files.open(uri)
end)
-config.config.diagnostics.disable['undefined-field'] = true
-config.config.diagnostics.disable['redundant-parameter'] = true
diag.start()
local clock = os.clock()