1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

test(nvim): fix make test for nvim 0.9.5

This commit is contained in:
Eric Wong 2024-03-21 18:25:14 +08:00
parent 44d77ab4bf
commit 7eb68ca364
23 changed files with 70 additions and 124 deletions

View File

@ -5,6 +5,14 @@
[vader-test.options.env]
VIM_BIN = 'nvim'
VIM_Es = "--headless"
[vader-nvim-050]
command = "make"
args = ['test']
isBackground = false
[vader-nvim-050.options.env]
VIM_BIN = 'D:\Neovim\v0.5.0\bin\nvim.exe'
VIM_Es = "--headless"
VIM = 'D:\Neovim\v0.5.0'
[vader-nvim-072]
command = "make"
args = ['test']
@ -23,6 +31,21 @@
VIM_BIN = 'D:\Vim\gvim_7.4.1185_x64\vim.exe'
VIM_Es = "-Es"
VIM = 'D:\Vim\gvim_7.4.1185_x64'
VIMRUNTIME = 'D:\Vim\gvim_7.4.1185_x64'
[vader-vim-741185-buf]
command = 'D:\Vim\gvim_7.4.1185_x64\vim.exe'
args = ['-Nu', 'test/vimrc', '-c', 'Vader! ${relativeFile}']
isBackground = false
[vader-vim-741185-buf.options.env]
VIM = 'D:\Vim\gvim_7.4.1185_x64'
VIMRUNTIME = 'D:\Vim\gvim_7.4.1185_x64'
[vader-nvim-buf]
command = 'nvim'
args = ['-Nu', 'test/vimrc', '--headless', '-c', 'Vader! ${relativeFile}']
isBackground = false
[vader-nvim-buf.options.env]
VIM = ''
VIMRUNTIME = ''
[generate-vim-doc]
command = "python"
args = ['-m', 'vimdoc', '.']

View File

@ -52,7 +52,6 @@ let s:SYSTEM = SpaceVim#api#import('system')
""
" Version of SpaceVim , this value can not be changed.
let g:spacevim_version = '2.3.0-dev'
lockvar g:spacevim_version
""
" @section default_indent, options-default_indent
@ -1367,6 +1366,9 @@ let g:spacevim_smartcloseignoreft = [
\ 'SpaceVimGitRemoteManager'
\ ]
let g:_spacevim_altmoveignoreft = ['Tagbar' , 'vimfiler']
let g:_spacevim_mappings_space = {}
let g:_spacevim_mappings_prefixs = {}
let g:_spacevim_mappings_windows = {}
let g:spacevim_enable_javacomplete2_py = 0
""
" @section src_root, options-src_root

View File

@ -173,7 +173,7 @@ let s:file_node_extensions = {
\ 'help' : '',
\ 'txt' : '',
\ 'toml' : '',
\ 'markdown' : '',
\ 'markdown' : '',
\ 'json' : '',
\ 'js' : '',
\ 'jsx' : '',
@ -302,7 +302,7 @@ function! s:self.fticon(path) abort
endif
endfor
let ext = fnamemodify(file, ':e')
if has_key(g:spacevim_filetype_icons, ext)
if has_key(get(g:, 'spacevim_filetype_icons', {}), ext)
return g:spacevim_filetype_icons[ext]
elseif has_key(s:file_node_extensions, ext)
return s:file_node_extensions[ext]

View File

@ -165,7 +165,12 @@ function! SpaceVim#layers#lang#scala#config() abort
autocmd BufRead,BufNewFile *.sbt set filetype=scala
augroup END
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
try
let g:neoformat_enabled_scala = neoformat#formatters#scala#enabled()
catch
let g:neoformat_enabled_scala = []
endtry
let g:neoformat_scala_scalariform = {
\ 'exe': 'java',
\ 'args': ['-jar', s:scalariform_jar, '-'],

View File

@ -13,7 +13,6 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort
exe 'nnoremap <silent><nowait> [Window] :<c-u>LeaderGuide "' .
\ a:key . '"<CR>'
exe 'nmap ' .a:key . ' [Window]'
let g:_spacevim_mappings_windows = {}
nnoremap <silent> [Window]v
\ :<C-u>split<CR>
let lnum = expand('<slnum>') + s:lnum - 4
@ -200,7 +199,6 @@ endfunction
function! SpaceVim#mapping#leader#defindKEYs() abort
call SpaceVim#logger#debug('defind SPC h k prefixs')
let g:_spacevim_mappings_prefixs = {}
if !g:spacevim_vimcompatible && !empty(g:spacevim_windows_leader)
let g:_spacevim_mappings_prefixs[g:spacevim_windows_leader] = {'name' : '+Window prefix'}
call extend(g:_spacevim_mappings_prefixs[g:spacevim_windows_leader], g:_spacevim_mappings_windows)

View File

@ -14,7 +14,6 @@ let s:file = expand('<sfile>:~')
let s:funcbeginline = expand('<slnum>') + 1
function! SpaceVim#mapping#space#init() abort
call SpaceVim#logger#debug('init SPC key bindings')
let g:_spacevim_mappings_space = {}
let g:_spacevim_mappings_prefixs['[SPC]'] = {'name' : '+SPC prefix'}
let g:_spacevim_mappings_space.t = {'name' : '+Toggles'}
let g:_spacevim_mappings_space.t.h = {'name' : '+Toggles highlight'}

View File

@ -29,8 +29,8 @@ local file_node_extensions = {
['css'] = '',
['less'] = '',
['wxss'] = '',
['md'] = '',
['markdown'] = '',
['md'] = '',
['markdown'] = '',
['json'] = '',
['js'] = '',
['jsx'] = '',

View File

@ -87,8 +87,8 @@ local function pick()
end
local function replace_variables(str)
for key, _ in ipairs(variables) do
str = vim.fn.substitute(str, '${' .. key .. '}', variables[key], 'g')
for key, value in pairs(variables) do
str = vim.fn.substitute(str, '${' .. key .. '}', value, 'g')
end
return str
end
@ -142,6 +142,11 @@ function M.get()
return task
end
function M.expand_task(t)
init_variables()
return expand_task(t)
end
local function open_task()
local line = vim.fn.getline('.')

View File

@ -4,10 +4,12 @@ local conf = require('telescope.config').values
local entry_display = require('telescope.pickers.entry_display')
local finders = require('telescope.finders')
local pickers = require('telescope.pickers')
local taskmanager = require('spacevim.plugin.tasks')
local runner = require('spacevim.plugin.runner')
local function prepare_project_task_output(register)
local rst = {}
local taskconfig = vim.api.nvim_eval('SpaceVim#plugins#tasks#get_tasks()')
local taskconfig = taskmanager.get_tasks()
for k, v in pairs(taskconfig) do
table.insert(rst, {
name = k,
@ -76,9 +78,7 @@ local function show_taskconfig(opts)
actions.select_default:replace(function()
local entry = action_state.get_selected_entry()
actions.close(prompt_bufnr)
-- vim.fn.setreg('"', entry.value[1])
local task = entry.value.task
vim.fn['SpaceVim#plugins#runner#run_task'](task)
runner.run_task(taskmanager.expand_task(entry.value.task))
end)
return true
end,

View File

@ -2,7 +2,7 @@ Execute ( SpaceVim api: file.fticon ):
scriptencoding utf-8
let g:spacevim_filetype_icons = {}
let file = SpaceVim#api#import('file')
AssertEqual file.fticon('foo.md'), ''
AssertEqual file.fticon('foo.md'), ''
Execute ( SpaceVim api: file.unify_path ):
let path = fnamemodify('.SpaceVim.d/init.vim', ':p')

View File

@ -1,7 +0,0 @@
Execute ( SpaceVim api: SpaceVim main code ):
unlock g:_spacevim_root_dir
if has('nvim')
source init.vim
else
source vimrc
endif

View File

@ -1,4 +1,9 @@
Execute ( SpaceVim layer health: ):
runtime autoload/SpaceVim.vim
call SpaceVim#mapping#g#init()
call SpaceVim#mapping#z#init()
call SpaceVim#mapping#leader#defindKEYs()
call SpaceVim#mapping#space#init()
for layer in SpaceVim#layers#list()
Log 'testing ' . layer . ' layer'
Assert SpaceVim#layers#{layer}#health(), 'function SpaceVim#layers#' . layer . '#health() return false'

View File

@ -1,7 +1,9 @@
Execute ( SpaceVim lua api: data.dict ):
if get(g:, 'spacevim_use_lua', 0)
if has('nvim-0.5.0') || get(g:, '_spacevim_use_lua', 0)
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_dict = require('spacevim.api').import('data.dict')
AssertEqual cmp.luaeval('spacevim_dict.make({"a" , "b", "h"}, {"c", "d"}, "m")'), {'a' : 'c', 'b' : 'd', 'h' : 'm'}
else
Log 'skip lua test'
endif

View File

@ -1,5 +1,5 @@
Execute ( SpaceVim lua api: data.json ):
if get(g:, 'spacevim_use_lua', 0)
if has('nvim-0.5.0') || has('+lua')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_json = require('spacevim.api').import('data.json')
lua context = '{"java" : "hello world"}'

View File

@ -1,5 +1,5 @@
Execute ( SpaceVim lua api: data.list ):
if get(g:, 'spacevim_use_lua', 0)
if has('nvim-0.5.0') || has('+lua')
let cmp = SpaceVim#api#import('vim#compatible')
lua spacevim_list = require('spacevim.api').import('data.list')
lua context = {"java", "hello world"}

View File

@ -1,10 +0,0 @@
local prompt = require('spacevim.api').import('prompt')
local function handle_fly(...)
end
prompt._handle_fly = handle_fly
prompt.open()

View File

@ -1,5 +1,5 @@
Execute ( SpaceVim lua api: vim.keys.t(str) ):
if has('nvim-0.5.0')
if has('nvim-0.5.0') || has('+lua')
lua spacevim_api_argv = require('spacevim.api').import('vim.argv')
AssertEqual luaeval("spacevim_api_argv.parser('a b \"c d\"')"), ['a', 'b', 'c d']
AssertEqual luaeval("spacevim_api_argv.parser('a b \"c \\\\\" d\"')"), ['a', 'b', 'c " d']

View File

@ -1,25 +0,0 @@
local job = require('spacevim.api.job')
local jobid = job.start({'lua53', '-'}, {
on_stdout = function(id, data)
vim.print(id)
vim.print(vim.inspect(data))
end,
on_stderr = function(id, data)
vim.print(id)
vim.print(vim.inspect(data))
end,
on_exit = function(id, code, signal)
vim.print(id)
vim.print('exit code', code)
vim.print('exit signal', signal)
end,
})
job.send(jobid, 'print(1)\n')
job.send(jobid, 'print(1)\n')
job.send(jobid, 'print(1)\n')
job.send(jobid, 'print(1)\n')
job.chanclose(jobid, 'stdin')
job.stop(jobid)

View File

@ -1,55 +0,0 @@
local toml = require('spacevim.api.data.toml')
print(vim.inspect(toml.parse_file('mode/basic.toml')))
print(vim.inspect(vim.api.nvim_eval("SpaceVim#api#import('data#toml').parse_file('mode/basic.toml')")))
-- {
-- layers = { {
-- auto_completion_return_key_behavior = "complete",
-- auto_completion_tab_key_behavior = "cycle",
-- name = "autocomplete"
-- }, {
-- default_height = 30,
-- default_position = "top",
-- name = "shell"
-- } },
-- options = {
-- buffer_index_type = 4,
-- colorscheme = "gruvbox",
-- colorscheme_bg = "dark",
-- enable_guicolors = false,
-- enable_statusline_mode = false,
-- enable_tabline_filetype_icon = false,
-- statusline_iseparator = "bar",
-- statusline_separator = "nil",
-- statusline_unicode = false,
-- vimcompatible = true,
-- windows_index_type = 3
-- }
-- }
-- {
-- layers = { {
-- auto_completion_return_key_behavior = "complete",
-- auto_completion_tab_key_behavior = "cycle",
-- name = "autocomplete"
-- }, {
-- default_height = 30,
-- default_position = "top",
-- name = "shell"
-- } },
-- options = {
-- buffer_index_type = 4,
-- colorscheme = "gruvbox",
-- colorscheme_bg = "dark",
-- enable_guicolors = 0,
-- enable_statusline_mode = 0,
-- enable_tabline_filetype_icon = 0,
-- statusline_iseparator = "bar",
-- statusline_separator = "nil",
-- statusline_unicode = 0,
-- vimcompatible = 1,
-- windows_index_type = 3
-- }
-- }

View File

@ -1,17 +1,16 @@
Execute ( SpaceVim plugin: flygrep ):
runtime autoload/SpaceVim.vim
edit Makefile
let g:_spacevim_input_list = ["\<C-u>", 'C', 'O', 'V', 'I', 'M', 'E', 'R', 'A', 'G', 'E', "\<Enter>"]
let g:_spacevim_input_list = ["\<C-u>", 'b', 'u', 'i', 'l', 'd', '/', 'v', 'a', 'd', 'e', 'r', ':', "\<Enter>"]
let g:_spacevim_input_timeout = 400
exe 'call SpaceVim#plugins#flygrep#open('
\ . '{"input" : expand("<cword>"), "files": bufname("%")}'
\ . ')'
exe 'call SpaceVim#plugins#flygrep#open({"input" : expand("<cword>"), "files": bufname("%")})'
let g:_spacevim_input_timeout = 0
let lnr = 0
let current_line = line('.')
Log getline('.')
for line in readfile('Makefile')
let lnr += 1
if line =~# 'COVIMERAGE'
if line =~# 'build/vader:'
break
endif
endfor

View File

@ -1,5 +1,4 @@
Execute ( SpaceVim plugin: key bindings guide ):
let g:_spacevim_input_list = ['t', 't']
LeaderGuide " "
call SpaceVim#plugins#tabmanager#open()
AssertEqual &ft, 'SpaceVimTabsManager'

View File

@ -1,4 +1,9 @@
Execute ( SpaceVim plugin: help ):
runtime autoload/SpaceVim.vim
call SpaceVim#mapping#g#init()
call SpaceVim#mapping#z#init()
call SpaceVim#mapping#leader#defindKEYs()
call SpaceVim#mapping#space#init()
let g:_spacevim_input_list = ['h', 'd', 'k', ' ', 'b', 'n']
LeaderGuide " "
AssertEqual &ft, 'HelpDescribe'

View File

@ -5,6 +5,7 @@ filetype off
set rtp+=build/vader
set rtp+=.
set rtp+=after
set noswapfile
filetype plugin indent on
syntax enable
set nocompatible