diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/crossfile/completion.lua | 59 | ||||
-rw-r--r-- | test/crossfile/definition.lua | 42 |
2 files changed, 101 insertions, 0 deletions
diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 04ec10b3..d07a2eac 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -3,6 +3,7 @@ local core = require 'core.completion' local furi = require 'file-uri' local platform = require 'bee.platform' local util = require 'utility' +local config = require 'config' rawset(_G, 'TEST', true) @@ -357,6 +358,64 @@ TEST { } } + +local originRuntimePath = config.config.runtime.path +config.config.runtime.path = { + '?/1.lua', +} + +TEST { + { + path = 'D:/xxxx/1.lua', + content = '', + }, + { + path = 'main.lua', + content = 'require "x$"', + main = true, + }, + completion = { + { + label = 'D:.xxxx', + kind = CompletionItemKind.Reference, + textEdit = EXISTS, + }, + { + label = 'xxxx', + kind = CompletionItemKind.Reference, + textEdit = EXISTS, + }, + } +} + +config.config.runtime.path = originRuntimePath + +local originRuntimePath = config.config.runtime.path +config.config.runtime.path = { + 'd:/?/1.lua', +} + +TEST { + { + path = 'd:/xxxx/1.lua', + content = '', + }, + { + path = 'main.lua', + content = 'require "x$"', + main = true, + }, + completion = { + { + label = 'xxxx', + kind = CompletionItemKind.Reference, + textEdit = EXISTS, + }, + } +} + +config.config.runtime.path = originRuntimePath + TEST { { path = 'a.lua', diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index 24c97321..b72646e7 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -717,3 +717,45 @@ TEST { } } platform.OS = originOS + +local originRuntimePath = config.config.runtime.path +config.config.runtime.path = { + '?/1.lua', +} +TEST { + { + path = 'd:\\xxxx\\1.lua', + content = [[ + return <!function () end!> + ]], + }, + { + path = 'main.lua', + content = [[ + local <!f!> = require 'xxxx' + print(<?f?>) + ]], + }, +} +config.config.runtime.path = originRuntimePath + +local originRuntimePath = config.config.runtime.path +config.config.runtime.path = { + 'd:/?/1.lua', +} +TEST { + { + path = 'd:\\xxxx\\1.lua', + content = [[ + return <!function () end!> + ]], + }, + { + path = 'main.lua', + content = [[ + local <!f!> = require 'xxxx' + print(<?f?>) + ]], + }, +} +config.config.runtime.path = originRuntimePath |