Skip to content

Commit

Permalink
Added general unittest + Python unittests
Browse files Browse the repository at this point in the history
Added minor version bump to 2.18.0
  • Loading branch information
ColinKennedy committed May 14, 2024
1 parent 0daffce commit b087072
Show file tree
Hide file tree
Showing 8 changed files with 981 additions and 3 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
on: [push, pull_request]
name: test

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
nvim-versions: ['nightly']
name: test
steps:
- name: checkout
uses: actions/checkout@v3

- uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.nvim-versions }}

- name: run tests
run: make test
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
TESTS_INIT=tests/minimal_init.lua
TESTS_DIR=tests/

.PHONY: test

documentation:
nvim --headless --noplugin -u ./scripts/minimal_init.vim -c "lua MiniDoc.generate()" -c "qa!"

tag:
./scripts/generate_tag.sh

test:
@nvim \
--headless \
--noplugin \
-u ${TESTS_INIT} \
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }"
5 changes: 4 additions & 1 deletion doc/neogen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,15 @@ Feel free to submit a PR, I will be happy to help you !
We use semantic versioning ! (https://semver.org)
Here is the current Neogen version:
>
neogen.version = "2.17.1"
neogen.version = "2.18.0"
<
# Changelog~

Note: We will only document `major` and `minor` versions, not `patch` ones. (only X and Y in X.Y.z)

## 2.18.0~
- Added plenary unittests to the repository
- Added Python + Google-style docstrings
## 2.17.1~
- Python raises now supports `raise foo.Bar()` syntax
## 2.17.0~
Expand Down
2 changes: 1 addition & 1 deletion lua/neogen/configurations/python.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ return {
end

if nodes[i.Return] then
validate_bare_returns(nodes)
validate_direct_returns(nodes, node)
validate_bare_returns(nodes)
end

validate_yield_nodes(nodes)
Expand Down
2 changes: 1 addition & 1 deletion lua/neogen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ end
--- with multiple annotation conventions.
---@tag neogen-changelog
---@toc_entry Changes in neogen plugin
neogen.version = "2.17.1"
neogen.version = "2.18.0"
--minidoc_afterlines_end

return neogen
27 changes: 27 additions & 0 deletions tests/minimal_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local plugins = {
["https://github.com/nvim-treesitter/nvim-treesitter"] = os.getenv("NVIM_TREESITTER_DIRECTORY")
or "/tmp/nvim_treesitter",
["https://github.com/nvim-lua/plenary.nvim"] = os.getenv("PLENARY_DIRECTORY") or "/tmp/plenary.nvim",
}

local tests_directory = vim.fn.fnamemodify(vim.fn.expand("<sfile>"), ":h")
local plugin_root = vim.fn.fnamemodify(tests_directory, ":h")
vim.opt.runtimepath:append(plugin_root)

for url, directory in pairs(plugins) do
if vim.fn.isdirectory(directory) == 0 then
vim.fn.system({ "git", "clone", url, directory })
end

vim.opt.runtimepath:append(directory)
end

vim.cmd("runtime plugin/plenary.vim")
require("plenary.busted")

vim.cmd("runtime plugin/nvim-treesitter.lua")

-- Some tests require the Python parser
vim.cmd([[TSInstallSync! python]])

require("neogen").setup({ snippet_engine = "nvim" })
Loading

0 comments on commit b087072

Please sign in to comment.