summaryrefslogtreecommitdiff
path: root/test/code_action
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-05 22:06:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-07 09:55:31 +0800
commit48c7a420e07fff03a88542c3b22f6f61b3cfc95b (patch)
tree86f9ea38b65b0afc57dae20cbbb3b2a90060f915 /test/code_action
parenta5895f626bb130b8bbf2687f8b43f0ceac06b342 (diff)
downloadlua-language-server-48c7a420e07fff03a88542c3b22f6f61b3cfc95b.zip
Revert "Revert "stash""
This reverts commit 9c03601143094f6552a90b7e3f4975594bc00553.
Diffstat (limited to 'test/code_action')
-rw-r--r--test/code_action/init.lua36
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'] = {
+
+ }
+ }
+ }
+ }
+}