diff options
Diffstat (limited to 'test/tclient/tests/single-mode.lua')
-rw-r--r-- | test/tclient/tests/single-mode.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/tclient/tests/single-mode.lua b/test/tclient/tests/single-mode.lua new file mode 100644 index 00000000..bdf831f4 --- /dev/null +++ b/test/tclient/tests/single-mode.lua @@ -0,0 +1,46 @@ +local await = require 'await' +local lclient = require 'tclient.lclient' +local ws = require 'workspace' +local util = require 'utility' + +---@async +lclient():start(function (client) + client:awaitRequest('initialize', { + clientInfo = { + name = 'unit-test', + version = 'single-mode', + }, + rootUri = nil, + }) + + client:notify('initialized') + + client:notify('textDocument/didOpen', { + textDocument = { + uri = 'test://single-file.lua', + languageId = 'lua', + version = 0, + text = [[ +local x +print(x) +]] + } + }) + + ws.awaitReady() + + local locations = client:awaitRequest('textDocument.definition', { + textDocument = { uri = 'test://single-file.lua' }, + position = { line = 1, character = 7 }, + }) + + assert(util.equal(locations, { + { + uri = 'test://single-file.lua', + range = { + start = { line = 0, character = 6 }, + ['end'] = { line = 0, character = 7 }, + } + } + })) +end) |