mirror of
https://github.com/hanzoai/hanzo.vim.git
synced 2026-11-09 15:19:11 +00:00
68 lines
1.5 KiB
Plaintext
68 lines
1.5 KiB
Plaintext
Before:
|
|
Save g:neural
|
|
|
|
runtime autoload/neural.vim
|
|
|
|
unlet! g:neural
|
|
|
|
let g:calls = []
|
|
|
|
function! neural#Run(prompt, options) abort
|
|
call add(g:calls, ['neural#Run', a:prompt, a:options])
|
|
endfunction
|
|
|
|
let g:output = ''
|
|
|
|
After:
|
|
unlet! g:calls
|
|
unlet! g:output
|
|
|
|
runtime autoload/neural/job.vim
|
|
|
|
Restore
|
|
|
|
" Clean up any buffers run during tests.
|
|
silent! bdelete! 'Neural Buffer'
|
|
silent! bdelete! 'Test Neural Buffer Name'
|
|
|
|
Execute(It should create a neural buffer with default settings):
|
|
NeuralBuffer
|
|
|
|
AssertEqual 1, bufexists('Neural Buffer')
|
|
AssertEqual 'neuralbuf', &filetype
|
|
" TODO: Assert if created with new or vertical new
|
|
AssertEqual 1, &l:wrap
|
|
AssertEqual 1, &l:linebreak
|
|
|
|
Execute(It should create a neural buffer with arguments):
|
|
NeuralBuffer {"name": "Test Neural Buffer Name", "create_mode": "horizontal", "wrap": v:false}
|
|
|
|
AssertEqual 1, bufexists('Test Neural Buffer Name')
|
|
AssertEqual 'neuralbuf', &filetype
|
|
" TODO: Assert if created with new or vertical new
|
|
AssertEqual 0, &l:wrap
|
|
AssertEqual 0, &l:linebreak
|
|
|
|
Given neuralbuf(A Neural buffer):
|
|
write a story
|
|
Execute(It should correctly run neural):
|
|
NeuralCompletion
|
|
|
|
AssertEqual
|
|
\ [
|
|
\ ['neural#Run', 'write a story', {'line': 1, 'echo': 0}],
|
|
\ ],
|
|
\ g:calls
|
|
|
|
" Plug mappings
|
|
Execute(The correct neural buffer keybinds should be configured):
|
|
redir => g:output
|
|
silent map <Plug>(neural_completion)
|
|
redir END
|
|
|
|
AssertEqual
|
|
\ [
|
|
\ 'n <Plug>(neural_completion) *@:NeuralCompletion<CR>',
|
|
\ ],
|
|
\ sort(split(g:output, "\n"))
|