summaryrefslogtreecommitdiff
path: root/test/code_action
diff options
context:
space:
mode:
authorSewbacca <sebastian.kalus@kolabnow.com>2023-07-17 14:56:05 +0200
committerSewbacca <sebastian.kalus@kolabnow.com>2023-07-17 14:56:05 +0200
commit0c31e3027772f10f7a0b4d2e3892449018e195d8 (patch)
tree410478a2bfc2ee6fc5321e1228a80955a7dbf2c6 /test/code_action
parent393f3e844d5164116de8bd739fc06d76bd03439f (diff)
downloadlua-language-server-0c31e3027772f10f7a0b4d2e3892449018e195d8.zip
Added tests
Diffstat (limited to 'test/code_action')
-rw-r--r--test/code_action/init.lua65
1 files changed, 63 insertions, 2 deletions
diff --git a/test/code_action/init.lua b/test/code_action/init.lua
index 3d107edd..ed145766 100644
--- a/test/code_action/init.lua
+++ b/test/code_action/init.lua
@@ -183,8 +183,6 @@ local t = {
-- },
--}
--- TODO: Add some tests for ACTION_AUTOREQUIRE
-
TEST_CROSSFILE {
[[
<?unrequiredModule?>.myFunction()
@@ -214,4 +212,67 @@ TEST_CROSSFILE {
},
}
}
+}
+
+TEST_CROSSFILE {
+[[
+ <?myModule?>.myFunction()
+]],
+ {
+ path = 'myModule/init.lua',
+ content = [[
+ local m = {}
+ m.myFunction = print
+ return m
+ ]]
+ }
+} {
+ {
+ title = lang.script('ACTION_AUTOREQUIRE', 'myModule.init', 'myModule'),
+ kind = 'refactor.rewrite',
+ command = {
+ title = 'autoRequire',
+ command = 'lua.autoRequire',
+ arguments = {
+ {
+ uri = TESTURI,
+ target = furi.encode 'myModule/init.lua',
+ name = 'myModule',
+ requireName = 'myModule.init'
+ },
+ },
+ }
+ },
+ {
+ title = lang.script('ACTION_AUTOREQUIRE', 'init', 'myModule'),
+ kind = 'refactor.rewrite',
+ command = {
+ title = 'autoRequire',
+ command = 'lua.autoRequire',
+ arguments = {
+ {
+ uri = TESTURI,
+ target = furi.encode 'myModule/init.lua',
+ name = 'myModule',
+ requireName = 'init'
+ },
+ },
+ }
+ },
+ {
+ title = lang.script('ACTION_AUTOREQUIRE', 'myModule', 'myModule'),
+ kind = 'refactor.rewrite',
+ command = {
+ title = 'autoRequire',
+ command = 'lua.autoRequire',
+ arguments = {
+ {
+ uri = TESTURI,
+ target = furi.encode 'myModule/init.lua',
+ name = 'myModule',
+ requireName = 'myModule'
+ },
+ },
+ }
+ },
} \ No newline at end of file