summaryrefslogtreecommitdiff
path: root/lua/99/test/fill_in_function_spec.lua
diff options
context:
space:
mode:
authorThePrimeAgain <theprimeagain@theprimeagain.com>2025-12-06 11:12:20 -0700
committerThePrimeAgain <theprimeagain@theprimeagain.com>2025-12-06 11:12:20 -0700
commit045ac5e104765415337d691ec923afa1cbd032c8 (patch)
tree3697940fcb62c920daecad66b7bc3ce30b6e444c /lua/99/test/fill_in_function_spec.lua
parent3ae40439f36baeb96979a77cb5faf0dd6890bf31 (diff)
downloada4-045ac5e104765415337d691ec923afa1cbd032c8.tar.xz
a4-045ac5e104765415337d691ec923afa1cbd032c8.zip
virtual text is running! no testings yet
Diffstat (limited to 'lua/99/test/fill_in_function_spec.lua')
-rw-r--r--lua/99/test/fill_in_function_spec.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/lua/99/test/fill_in_function_spec.lua b/lua/99/test/fill_in_function_spec.lua
new file mode 100644
index 0000000..4aad1a7
--- /dev/null
+++ b/lua/99/test/fill_in_function_spec.lua
@@ -0,0 +1,52 @@
+-- luacheck: globals describe it assert
+local _99 = require("99")
+local test_utils = require("99.test.test_utils")
+local eq = assert.are.same
+local test_content = require("99.test.test_content")
+
+--- @param content string[]
+--- @return _99.test.Provider, number
+local function setup(content)
+ local p = test_utils.TestProvider.new()
+ _99.setup({
+ provider = p,
+ })
+
+ local buffer = test_utils.create_file(content, "lua", 2)
+ return p, buffer
+end
+
+--- @param buffer number
+--- @return string[]
+local function r(buffer)
+ return vim.api.nvim_buf_get_lines(buffer, 0, -1, false)
+end
+
+local cases = {
+ { "single line", test_content.empty_function_single_line },
+ { "multiline", test_content.empty_function_2_lines },
+}
+
+describe("fill_in_function", function()
+ for _, case in ipairs(cases) do
+ it(case[1], function()
+ local p, buffer = setup(case[2])
+ _99.fill_in_function()
+ eq(case[2], r(buffer))
+
+ p:resolve(true, "function foo()\n return 42\nend")
+ test_utils.next_frame()
+
+ local expected_state = {
+ "",
+ "function foo()",
+ " return 42",
+ "end",
+ "",
+ }
+ eq(expected_state, r(buffer))
+ end)
+ end
+ it("stdout into function virtual text", function()
+ end)
+end)