summaryrefslogtreecommitdiff
path: root/lua/99/test/qfix_navigation_spec.lua
diff options
context:
space:
mode:
authortheprimeagain <the.primeagen@gmail.com>2026-02-25 15:14:48 -0700
committertheprimeagain <the.primeagen@gmail.com>2026-02-25 15:14:48 -0700
commit9be01a1a50a61635ea7169e01c85fab41638ad66 (patch)
treea4d50311770e1eed49bf330dd0596db19fc7cea3 /lua/99/test/qfix_navigation_spec.lua
parentba72babb9d606f021ef0697a572ced10d5ff0d48 (diff)
downloada4-9be01a1a50a61635ea7169e01c85fab41638ad66.tar.xz
a4-9be01a1a50a61635ea7169e01c85fab41638ad66.zip
the vibe stuff is sort of there. I genuinely dislike what it is, moving
on
Diffstat (limited to 'lua/99/test/qfix_navigation_spec.lua')
-rw-r--r--lua/99/test/qfix_navigation_spec.lua70
1 files changed, 70 insertions, 0 deletions
diff --git a/lua/99/test/qfix_navigation_spec.lua b/lua/99/test/qfix_navigation_spec.lua
new file mode 100644
index 0000000..f079a9e
--- /dev/null
+++ b/lua/99/test/qfix_navigation_spec.lua
@@ -0,0 +1,70 @@
+-- luacheck: globals describe it assert before_each
+local _99 = require("99")
+local test_utils = require("99.test.test_utils")
+local eq = assert.are.same
+
+local content = {
+ "local value = 1",
+ "return value",
+}
+
+local function qfix_first_text()
+ local items = vim.fn.getqflist()
+ local first = items[1]
+ assert(first, "expected a quickfix item")
+ return first.text
+end
+
+describe("qfix navigation", function()
+ local provider
+ local results = {}
+
+ before_each(function()
+ provider = test_utils.test_setup(content, 1, 0)
+ end)
+
+ it("navigates older and newer search quickfix results", function()
+ _99.search({ additional_prompt = "search one" })
+ provider:resolve("success", "/tmp/one.lua:1:1,1,first search")
+ test_utils.next_frame()
+
+ _99.search({ additional_prompt = "search two" })
+ provider:resolve("success", "/tmp/two.lua:1:1,1,second search")
+ test_utils.next_frame()
+
+ _99.search({ additional_prompt = "search three" })
+ provider:resolve("success", "/tmp/three.lua:1:1,1,third search")
+ test_utils.next_frame()
+
+ _99.qfix_older({ operation = "search" })
+ eq("second search", qfix_first_text())
+
+ _99.qfix_older({ operation = "search" })
+ eq("first search", qfix_first_text())
+
+ _99.qfix_newer({ operation = "search" })
+ eq("second search", qfix_first_text())
+
+ _99.qfix_top({ operation = "search" })
+ eq("third search", qfix_first_text())
+ end)
+
+ it("navigates vibe quickfix history through vibe results", function()
+ _99.vibe({ additional_prompt = "vibe one" })
+ provider:resolve("success", "/tmp/a.lua:1:1,1,first vibe")
+ test_utils.next_frame()
+
+ _99.vibe({ additional_prompt = "vibe two" })
+ provider:resolve("success", "/tmp/b.lua:1:1,1,second vibe")
+ test_utils.next_frame()
+
+ _99.qfix_top({ operation = "vibe" })
+ eq("second vibe", qfix_first_text())
+
+ _99.qfix_older({ operation = "vibe" })
+ eq("first vibe", qfix_first_text())
+
+ _99.qfix_newer({ operation = "vibe" })
+ eq("second vibe", qfix_first_text())
+ end)
+end)