summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-05-15 19:24:48 +0800
committersumneko <sumneko@hotmail.com>2019-05-15 19:24:48 +0800
commit632b98d4ddeadadc0c362391020e96ae2736accd (patch)
tree9712c5b1154cb6a45dbc7068914bb4e9bb6d3cd6 /server/test
parent935faea26c5f148651d1371e6979f016a14c3aa0 (diff)
downloadlua-language-server-632b98d4ddeadadc0c362391020e96ae2736accd.zip
整理代码
Diffstat (limited to 'server/test')
-rw-r--r--server/test/crossfile/completion.lua5
-rw-r--r--server/test/crossfile/definition.lua5
-rw-r--r--server/test/crossfile/document_symbol.lua9
-rw-r--r--server/test/crossfile/hover.lua11
-rw-r--r--server/test/crossfile/references.lua7
5 files changed, 21 insertions, 16 deletions
diff --git a/server/test/crossfile/completion.lua b/server/test/crossfile/completion.lua
index 4ee9508e..6fbc0541 100644
--- a/server/test/crossfile/completion.lua
+++ b/server/test/crossfile/completion.lua
@@ -2,6 +2,7 @@ local service = require 'service'
local workspace = require 'workspace'
local fs = require 'bee.filesystem'
local core = require 'core'
+local uric = require 'uri'
rawset(_G, 'TEST', true)
@@ -71,7 +72,7 @@ function TEST(data)
local mainBuf
local pos
for _, info in ipairs(data) do
- local uri = ws:uriEncode(fs.path(info.path))
+ local uri = uric.encode(fs.path(info.path))
local script = info.content
if info.main then
pos = script:find('$', 1, true) - 1
@@ -80,7 +81,7 @@ function TEST(data)
mainBuf = script
end
lsp:saveText(uri, 1, script)
- ws:addFile(ws:uriDecode(uri))
+ ws:addFile(uric.decode(uri))
while lsp._needCompile[1] do
lsp:compileVM(lsp._needCompile[1])
diff --git a/server/test/crossfile/definition.lua b/server/test/crossfile/definition.lua
index 90bf1651..73752ae6 100644
--- a/server/test/crossfile/definition.lua
+++ b/server/test/crossfile/definition.lua
@@ -2,6 +2,7 @@ local service = require 'service'
local workspace = require 'workspace'
local fs = require 'bee.filesystem'
local core = require 'core'
+local uric = require 'uri'
rawset(_G, 'TEST', true)
@@ -51,7 +52,7 @@ function TEST(datas)
local sourceList, sourceUri
for i, data in ipairs(datas) do
- local uri = ws:uriEncode(fs.path(data.path))
+ local uri = uric.encode(fs.path(data.path))
local new, list = catch_target(data.content, '!')
if new ~= data.content or data.target then
if data.target then
@@ -79,7 +80,7 @@ function TEST(datas)
data.content = new
end
lsp:saveText(uri, 1, data.content)
- ws:addFile(ws:uriDecode(uri))
+ ws:addFile(uric.decode(uri))
end
while lsp._needCompile[1] do
diff --git a/server/test/crossfile/document_symbol.lua b/server/test/crossfile/document_symbol.lua
index e09ed5d1..997d42c5 100644
--- a/server/test/crossfile/document_symbol.lua
+++ b/server/test/crossfile/document_symbol.lua
@@ -2,6 +2,7 @@ local service = require 'service'
local workspace = require 'workspace'
local fs = require 'bee.filesystem'
local core = require 'core'
+local uric = require 'uri'
local SymbolKind = {
File = 1,
@@ -67,13 +68,13 @@ function TEST(data)
local ws = workspace(lsp, 'test')
lsp.workspace = ws
- local targetUri = ws:uriEncode(fs.path(data[1].path))
- local sourceUri = ws:uriEncode(fs.path(data[2].path))
+ local targetUri = uric.encode(fs.path(data[1].path))
+ local sourceUri = uric.encode(fs.path(data[2].path))
lsp:saveText(sourceUri, 1, data[2].content)
- ws:addFile(ws:uriDecode(sourceUri))
+ ws:addFile(uric.decode(sourceUri))
lsp:saveText(targetUri, 1, data[1].content)
- ws:addFile(ws:uriDecode(targetUri))
+ ws:addFile(uric.decode(targetUri))
while lsp._needCompile[1] do
lsp:compileVM(lsp._needCompile[1])
end
diff --git a/server/test/crossfile/hover.lua b/server/test/crossfile/hover.lua
index fc5df36a..f2dcd443 100644
--- a/server/test/crossfile/hover.lua
+++ b/server/test/crossfile/hover.lua
@@ -2,6 +2,7 @@ local service = require 'service'
local workspace = require 'workspace'
local fs = require 'bee.filesystem'
local core = require 'core'
+local uric = require 'uri'
rawset(_G, 'TEST', true)
@@ -57,16 +58,16 @@ function TEST(data)
ws.root = ROOT
local targetScript = data[1].content
- local targetUri = ws:uriEncode(fs.path(data[1].path))
+ local targetUri = uric.encode(fs.path(data[1].path))
local sourceScript, sourceList = catch_target(data[2].content, '?')
- local sourceUri = ws:uriEncode(fs.path(data[2].path))
+ local sourceUri = uric.encode(fs.path(data[2].path))
lsp:saveText(targetUri, 1, targetScript)
- ws:addFile(ws:uriDecode(targetUri))
+ ws:addFile(uric.decode(targetUri))
lsp:compileVM(targetUri)
lsp:saveText(sourceUri, 1, sourceScript)
- ws:addFile(ws:uriDecode(sourceUri))
+ ws:addFile(uric.decode(sourceUri))
lsp:compileVM(sourceUri)
local sourceVM = lsp:loadVM(sourceUri)
@@ -76,7 +77,7 @@ function TEST(data)
local hover = core.hover(source, lsp)
assert(hover)
if data.hover.description then
- local uriROOT = ws:uriEncode(ROOT):gsub('%%', '%%%%')
+ local uriROOT = uric.encode(ROOT):gsub('%%', '%%%%')
data.hover.description = data.hover.description:gsub('%$ROOT%$', uriROOT)
end
if hover.label then
diff --git a/server/test/crossfile/references.lua b/server/test/crossfile/references.lua
index dd1958aa..9f81707c 100644
--- a/server/test/crossfile/references.lua
+++ b/server/test/crossfile/references.lua
@@ -2,6 +2,7 @@ local service = require 'service'
local workspace = require 'workspace'
local fs = require 'bee.filesystem'
local core = require 'core'
+local uric = require 'uri'
rawset(_G, 'TEST', true)
@@ -79,11 +80,11 @@ function TEST(data)
local pos
local expect = {}
for _, info in ipairs(data) do
- local uri = ws:uriEncode(fs.path(info.path))
- ws:addFile(ws:uriDecode(uri))
+ local uri = uric.encode(fs.path(info.path))
+ ws:addFile(uric.decode(uri))
end
for _, info in ipairs(data) do
- local uri = ws:uriEncode(fs.path(info.path))
+ local uri = uric.encode(fs.path(info.path))
local script = info.content
local list = catch_target(script)
for _, location in ipairs(list) do