diff --git a/lua/plugin_name.lua b/lua/plugin_name.lua index 4a21ac4..fabecf4 100644 --- a/lua/plugin_name.lua +++ b/lua/plugin_name.lua @@ -21,7 +21,7 @@ M.setup = function(args) end M.hello = function() - module.my_first_function() + return module.my_first_function(M.config.opt) end return M diff --git a/lua/plugin_name/module.lua b/lua/plugin_name/module.lua index 7bea096..78a9962 100644 --- a/lua/plugin_name/module.lua +++ b/lua/plugin_name/module.lua @@ -2,8 +2,8 @@ local M = {} ---@return string -M.my_first_function = function() - return "hello world!" +M.my_first_function = function(greeting) + return greeting end return M diff --git a/tests/plugin_name/plugin_name_spec.lua b/tests/plugin_name/plugin_name_spec.lua index 42ab112..edf409a 100644 --- a/tests/plugin_name/plugin_name_spec.lua +++ b/tests/plugin_name/plugin_name_spec.lua @@ -2,11 +2,11 @@ local plugin = require("plugin_name") describe("setup", function() it("works with default", function() - assert("my first function with param = Hello!", plugin.hello()) + assert(plugin.hello() == "Hello!", "my first function with param = Hello!") end) it("works with custom var", function() plugin.setup({ opt = "custom" }) - assert("my first function with param = custom", plugin.hello()) + assert(plugin.hello() == "custom", "my first function with param = custom") end) end)