-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: associate test-output/position with 'test list' output
This vastly improves the support for position type 'dir', as Neotest will now execute a Go package (and ./... when one cannot be detected).
- Loading branch information
1 parent
41b1ca7
commit 8d053b4
Showing
7 changed files
with
208 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
local json = require("neotest-golang.json") | ||
local _ = require("plenary") | ||
|
||
describe("Go list", function() | ||
-- it("Returns tables", function() | ||
-- local input = {} | ||
-- local expected = {} | ||
-- assert.are_same(expected, json.parse_jsonlines(input)) | ||
-- end) | ||
|
||
it("Returns one entry", function() | ||
local input = [[{ | ||
"Dir": "foo" | ||
}]] | ||
local expected = { { Dir = "foo" } } | ||
assert.are_same( | ||
vim.inspect(expected), | ||
vim.inspect(json.parse_jsonlines(input)) | ||
) | ||
end) | ||
|
||
it("Returns two entries", function() | ||
local input = [[{ | ||
"Dir": "foo" | ||
} | ||
{ | ||
"Dir": "bar" | ||
} | ||
]] | ||
local expected = { { Dir = "foo" }, { Dir = "bar" } } | ||
assert.are_same( | ||
vim.inspect(expected), | ||
vim.inspect(json.parse_jsonlines(input)) | ||
) | ||
end) | ||
|
||
it("Returns three entries", function() | ||
local input = [[{ | ||
"Dir": "foo" | ||
} | ||
{ | ||
"Dir": "bar" | ||
} | ||
{ | ||
"Dir": "baz" | ||
} | ||
]] | ||
local expected = { { Dir = "foo" }, { Dir = "bar" }, { Dir = "baz" } } | ||
assert.are_same( | ||
vim.inspect(expected), | ||
vim.inspect(json.parse_jsonlines(input)) | ||
) | ||
end) | ||
it("Returns three entries with multiple fields", function() | ||
local input = [[{ | ||
"Dir": /Users/fredrik/code/public/neotest-golang/tests/go", | ||
"Module": { | ||
"Path": "github.com/fredrikaverpil/neotest-golang", | ||
"Main": true, | ||
"Dir": "/Users/fredrik/code/public/neotest-golang/tests/go", | ||
"GoMod": "/Users/fredrik/code/public/neotest-golang/tests/go/go.mod", | ||
"GoVersion": "1.22.2" | ||
} | ||
} | ||
{ | ||
"Dir": "bar" | ||
} | ||
{ | ||
"Dir": "baz" | ||
} | ||
]] | ||
local expected = { | ||
{ | ||
Dir = "/Users/fredrik/code/public/neotest-golang/tests/go", | ||
Module = { | ||
Path = "github.com/fredrikaverpil/neotest-golang", | ||
Main = true, | ||
Dir = "/Users/fredrik/code/public/neotest-golang/tests/go", | ||
GoMod = "/Users/fredrik/code/public/neotest-golang/tests/go/go.mod", | ||
GoVersion = "1.22.2", | ||
}, | ||
}, | ||
{ Dir = "bar" }, | ||
{ Dir = "baz" }, | ||
} | ||
assert.are_same( | ||
vim.inspect(expected), | ||
vim.inspect(json.parse_jsonlines(input)) | ||
) | ||
end) | ||
end) |
Oops, something went wrong.