Skip to content

Commit

Permalink
Handle nil test.name (#69)
Browse files Browse the repository at this point in the history
I assume the treesitter API changed (again) and caused this to start
breaking. If I try to run `debug_test()` outside of a test file, then I
get an exception for trying to concatenate a nil value. This commit just
fixes the "no test found" short-circuit clause to handle empty string or
nil.
  • Loading branch information
tlindsay authored Feb 21, 2024
1 parent a5cc8dc commit 64f7340
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/dap-go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ end
function M.debug_test()
local test = ts.closest_test()

if test.name == "" then
if test.name == "" or test.name == nil then
vim.notify("no test found")
return false
end
Expand Down

0 comments on commit 64f7340

Please sign in to comment.