-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33af536
commit d446ed3
Showing
5 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
import myio "io" | ||
|
||
import ( | ||
"github.com/joho/godotenv" | ||
corev1 "k8s.io/api/core/v1" | ||
) |
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,23 @@ | ||
local handler = require("gx.handlers.go") | ||
|
||
describe("go handler works", function() | ||
vim.cmd("edit test/fixtures/test.go") | ||
local function test_line(line, startpos, endpos, expected) | ||
for i = startpos, endpos do | ||
vim.api.nvim_win_set_cursor(0, { line, i }) | ||
assert.equals(expected, handler.handle()) | ||
end | ||
end | ||
it("parses single line imports", function() | ||
test_line(3, 0, 11, "https://pkg.go.dev/fmt") | ||
end) | ||
it("parses single line named imports", function() | ||
test_line(5, 0, 15, "https://pkg.go.dev/io") | ||
end) | ||
it("parses imports in list", function() | ||
test_line(8, 1, 26, "https://pkg.go.dev/github.com/joho/godotenv") | ||
end) | ||
it("parses named imports in list", function() | ||
test_line(9, 1, 27, "https://pkg.go.dev/k8s.io/api/core/v1") | ||
end) | ||
end) |
Submodule nvim-treesitter
added at
19f69a