-
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.
- Loading branch information
1 parent
ae439bd
commit ba6e20c
Showing
16 changed files
with
134 additions
and
161 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 |
---|---|---|
@@ -1 +1 @@ | ||
test/xdg | ||
.tests |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# This script is executed via tests/minimal_init.lua | ||
|
||
GITHUB="https://github.com" | ||
GITHUB_PLENARY="$GITHUB/nvim-lua/plenary.nvim" | ||
GITHUB_TELESCOPE="$GITHUB/nvim-telescope/telescope.nvim" | ||
GITHUB_LSPCONFIG="$GITHUB/neovim/nvim-lspconfig" | ||
GITHUB_NIO="$GITHUB/nvim-neotest/nvim-nio" | ||
GITHUB_NEOTEST="$GITHUB/nvim-neotest/neotest" | ||
GITHUB_TREESITTER="$GITHUB/nvim-treesitter/nvim-treesitter" | ||
|
||
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}") | ||
REPO_DIR=$(dirname "$(dirname "$SCRIPT_FILE")") | ||
|
||
TEST_ALL_DIR="$REPO_DIR/.tests/all/site/pack/deps/start" | ||
|
||
clone() { | ||
repo=$1 | ||
dest=$2 | ||
if [ ! -d "$dest" ]; then | ||
git clone --depth 1 "$repo" "$dest" | ||
fi | ||
} | ||
|
||
# Just for the main minimal_init.lua for neotest | ||
mkdir -p $TEST_ALL_DIR | ||
clone $GITHUB_PLENARY "$TEST_ALL_DIR/plenary.nvim" | ||
clone $GITHUB_LSPCONFIG "$TEST_ALL_DIR/lspconfig.nvim" | ||
clone $GITHUB_TELESCOPE "$TEST_ALL_DIR/telescope.nvim" | ||
clone $GITHUB_NIO "$TEST_ALL_DIR/nvim-nio" | ||
clone $GITHUB_NEOTEST "$TEST_ALL_DIR/neotest" | ||
clone $GITHUB_TREESITTER "$TEST_ALL_DIR/nvim-treesitter" |
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,29 @@ | ||
local M = {} | ||
|
||
-- function M.root(root) | ||
-- local f = debug.getinfo(1, "S").source:sub(2) | ||
-- return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "") | ||
-- end | ||
|
||
function M.init() | ||
vim.cmd([[set runtimepath=$VIMRUNTIME]]) | ||
vim.opt.runtimepath:append(".") | ||
vim.opt.swapfile = false | ||
|
||
vim.opt.packpath = { | ||
".tests/all/site", | ||
} | ||
|
||
vim.cmd([[ | ||
packadd plenary.nvim | ||
packadd neotest | ||
packadd nvim-nio | ||
packadd nvim-treesitter | ||
]]) | ||
-- vim.cmd("TSInstall go") | ||
end | ||
|
||
-- Ensure the required Neovim plugins are installed/cloned | ||
-- os.execute("test/install.sh") | ||
|
||
M.init() |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
module github.com/fredrikaverpil/neotest-golang | ||
|
||
go 1.22.2 |
Empty file.
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,11 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello, World!") | ||
} | ||
|
||
func Add(a, b int) int { | ||
return a + b | ||
} |
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,31 @@ | ||
local nio = require("nio") | ||
local adapter = require("neotest-golang") | ||
|
||
describe("Discovery of test positions", function() | ||
it("Discover OK", function() | ||
local test_filepath = vim.loop.cwd() .. "/test/unit/main_test.go" | ||
print(test_filepath) | ||
local tree = | ||
nio.tests.with_async_context(adapter.discover_positions, test_filepath) | ||
|
||
local result = tree:to_list() | ||
local expected = { | ||
{ | ||
id = test_filepath, | ||
name = vim.fn.fnamemodify(test_filepath, ":t"), | ||
path = test_filepath, | ||
range = { 0, 0, 10, 0 }, | ||
type = "file", | ||
}, | ||
{ | ||
id = test_filepath .. "::TestAdd", | ||
name = "TestAdd", | ||
path = test_filepath, | ||
range = { 0, 0, 10, 4 }, | ||
type = "test", | ||
}, | ||
} | ||
|
||
assert.are.same(expected, result) | ||
end) | ||
end) |
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 "testing" | ||
|
||
// A dummy test, just to assert that Go tests can run | ||
func TestAdd(t *testing.T) { | ||
if Add(1, 2) != 3 { | ||
t.Fail() | ||
} | ||
} |