diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-05 22:02:19 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-05 22:02:19 +0800 |
commit | 19dd94e4af06254595a949a61c9bd05c5a911328 (patch) | |
tree | 98cd3650c148ec9cb0c568fd94f3f29e7586217b /test | |
parent | 5aace85b14473a161e9c64a410b06bf90d563762 (diff) | |
download | lua-language-server-19dd94e4af06254595a949a61c9bd05c5a911328.zip |
stash
Diffstat (limited to 'test')
-rw-r--r-- | test/code_action/init.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/code_action/init.lua b/test/code_action/init.lua new file mode 100644 index 00000000..d3b2d768 --- /dev/null +++ b/test/code_action/init.lua @@ -0,0 +1,36 @@ +local core = require 'core.code-action' +local files = require 'files' +local lang = require 'language' + +rawset(_G, 'TEST', true) + +function TEST(script) + return function (expect) + files.removeAll() + local start = script:find('<?', 1, true) + local finish = script:find('?>', 1, true) + local pos = (start + finish) // 2 + 1 + local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ') + files.setText('', new_script) + local results = core('', pos) + assert(results) + assert(expect == results) + end +end + +TEST [[ +print(<?a?>, b, c) +]] +{ + { + title = lang.script.ACTION_SWAP_PARAMS, + kind = 'refactor.rewrite', + edit = { + change = { + ['file:///.lua'] = { + + } + } + } + } +} |