mirror of
https://github.com/mfussenegger/nvim-jdtls
synced 2024-09-16 14:34:13 +02:00
Add initial test setup
This commit is contained in:
parent
2cceff656f
commit
76adad8229
5 changed files with 72 additions and 2 deletions
39
.github/workflows/tests.yml
vendored
Normal file
39
.github/workflows/tests.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
name: Run tests
|
||||
on:
|
||||
pull_request: ~
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Run tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
neovim_version: ['nightly', 'v0.6.1']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: date +%F > todays-date
|
||||
- name: Restore cache for today's nightly.
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: _neovim
|
||||
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}
|
||||
|
||||
- name: Prepare plenary
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
|
||||
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start
|
||||
|
||||
- name: Setup neovim
|
||||
uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
neovim: true
|
||||
version: ${{ matrix.neovim_version }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}"
|
|
@ -3,4 +3,7 @@ ignore = {
|
|||
}
|
||||
read_globals = {
|
||||
"vim",
|
||||
"describe",
|
||||
"it",
|
||||
"assert",
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ local function parse_test_case(line)
|
|||
}
|
||||
end
|
||||
|
||||
local function parse(buf, tests)
|
||||
local lines = vim.split(buf, '\n')
|
||||
local function parse(content, tests)
|
||||
local lines = vim.split(content, '\n')
|
||||
local tracing = false
|
||||
local test = nil
|
||||
for _, line in ipairs(lines) do
|
||||
|
@ -53,6 +53,8 @@ local function parse(buf, tests)
|
|||
end
|
||||
end
|
||||
|
||||
M.__parse = parse
|
||||
|
||||
|
||||
local function mk_buf_loop(sock, handle_buffer)
|
||||
local buffer = ''
|
||||
|
|
23
tests/junit_spec.lua
Normal file
23
tests/junit_spec.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
describe('jdtls.junit', function()
|
||||
it('can parse test results', function()
|
||||
local junit = require 'jdtls.junit'
|
||||
local lines = {
|
||||
'%TESTC 1 v2',
|
||||
'%TSTTREE1,test_foo(io.bar.BarTest),false,1,false,-1,test_foo(io.bar.BarTest),,',
|
||||
'%TESTS 1,test_foo(io.bar.BarTest)',
|
||||
'%TESTE 1,test_foo(io.bar.BarTest)',
|
||||
'%RUNTIME2078',
|
||||
}
|
||||
local tests = {}
|
||||
junit.__parse(table.concat(lines, '\n'), tests)
|
||||
local expected = {
|
||||
{
|
||||
failed = false,
|
||||
fq_class = 'io.bar.BarTest',
|
||||
method = 'test_foo',
|
||||
traces = {},
|
||||
},
|
||||
}
|
||||
assert.are.same(expected, tests)
|
||||
end)
|
||||
end)
|
3
tests/minimal.vim
Normal file
3
tests/minimal.vim
Normal file
|
@ -0,0 +1,3 @@
|
|||
set rtp+=.
|
||||
set rtp+=../plenary.nvim
|
||||
runtime! plugin/plenary.vim
|
Loading…
Reference in a new issue