feat(test,ci): testing framework w/ ci integration
This commit is contained in:
parent
c91294f4bd
commit
e581baccac
6 changed files with 59 additions and 0 deletions
8
.busted
Normal file
8
.busted
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
_all = {
|
||||||
|
lua = 'nlua',
|
||||||
|
lpath = 'lua/?.lua;lua/?/init.lua',
|
||||||
|
helper = 'tests/minimal.lua',
|
||||||
|
},
|
||||||
|
default = { verbose = true },
|
||||||
|
}
|
||||||
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
|
|
@ -64,3 +64,16 @@ jobs:
|
||||||
run: uv tool install ruff
|
run: uv tool install ruff
|
||||||
- name: Lint Python files with ruff
|
- name: Lint Python files with ruff
|
||||||
run: ruff check scrapers/
|
run: ruff check scrapers/
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
nvim_version: [stable, nightly]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Run tests
|
||||||
|
uses: nvim-neorocks/nvim-busted-action@v1
|
||||||
|
with:
|
||||||
|
nvim_version: ${{ matrix.nvim_version }}
|
||||||
|
|
|
||||||
4
.luarocks
Normal file
4
.luarocks
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
lua_version = "5.1"
|
||||||
|
variables = {
|
||||||
|
CC = "gcc"
|
||||||
|
}
|
||||||
12
cp.nvim-scm-1.rockspec
Normal file
12
cp.nvim-scm-1.rockspec
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
rockspec_format = '3.0'
|
||||||
|
package = 'cp.nvim'
|
||||||
|
version = 'scm-1'
|
||||||
|
|
||||||
|
source = { url = 'git://github.com/barrett-ruth/cp.nvim' }
|
||||||
|
build = { type = 'builtin' }
|
||||||
|
|
||||||
|
test_dependencies = {
|
||||||
|
'lua >= 5.1',
|
||||||
|
'nlua',
|
||||||
|
'busted >= 2.1.1',
|
||||||
|
}
|
||||||
18
spec/init_spec.lua
Normal file
18
spec/init_spec.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
describe('cp.nvim', function()
|
||||||
|
it('can be required', function()
|
||||||
|
local cp = require('cp')
|
||||||
|
assert.is_not_nil(cp)
|
||||||
|
assert.is_function(cp.setup)
|
||||||
|
assert.is_function(cp.handle_command)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('has health check', function()
|
||||||
|
local health = require('cp.health')
|
||||||
|
assert.is_not_nil(health)
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('initializes properly', function()
|
||||||
|
local cp = require('cp')
|
||||||
|
assert.is_true(cp.is_initialized())
|
||||||
|
end)
|
||||||
|
end)
|
||||||
4
tests/minimal.lua
Normal file
4
tests/minimal.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.env.XDG_CONFIG_HOME = vim.fn.getcwd() .. '/.tests/xdg/config'
|
||||||
|
vim.env.XDG_DATA_HOME = vim.fn.getcwd() .. '/.tests/xdg/data'
|
||||||
|
vim.env.XDG_STATE_HOME = vim.fn.getcwd() .. '/.tests/xdg/state'
|
||||||
|
vim.opt.runtimepath:append(vim.fn.getcwd())
|
||||||
Loading…
Add table
Add a link
Reference in a new issue