diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-22 22:07:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-22 22:07:48 +0800 |
commit | 687313e295f299c1e0e410d4d72d96b1f87b681c (patch) | |
tree | ae20560a598fa26bdd3d2dfbb38781679c6bb31a /test/command | |
parent | c608e84003aed61a16484296edad3fe4ff363322 (diff) | |
download | lua-language-server-687313e295f299c1e0e410d4d72d96b1f87b681c.zip |
update
Diffstat (limited to 'test/command')
-rw-r--r-- | test/command/auto-require.lua | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/test/command/auto-require.lua b/test/command/auto-require.lua index 94bb5069..a52662fb 100644 --- a/test/command/auto-require.lua +++ b/test/command/auto-require.lua @@ -3,7 +3,7 @@ local files = require 'files' local autoRequire = require 'core.command.autoRequire' local client = require 'client' -local findInsertOffset = util.getUpvalue(autoRequire, 'findInsertOffset') +local findInsertRow = util.getUpvalue(autoRequire, 'findInsertRow') local applyAutoRequire = util.getUpvalue(autoRequire, 'applyAutoRequire') local originEditText = client.editText @@ -19,18 +19,25 @@ function TEST(text) files.removeAll() files.setText('', text) EditResult = nil - local offset, fmt = findInsertOffset('') - applyAutoRequire('', offset, name, name, fmt) + local row, fmt = findInsertRow('') + applyAutoRequire('', row, name, name, fmt) assert(util.equal(EditResult, expect)) end end end --- TODO change to position TEST '' 'test' { start = 0, - finish = -1, - text = '\nlocal test = require "test"\n' + finish = 0, + text = 'local test = require "test"\n' +} + +TEST [[ +local aaaaaa = require 'aaa' +]] 'test' { + start = 10000, + finish = 10000, + text = 'local test = require \'test\'\n' } client.editText = originEditText |