diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/code_action/init.lua | 65 |
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 |