dev (#1)
* dev * Improve sync design * Support buffer local mapping * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * stylua * tmp * tmp * tmp * tmp * tmp * tmp * tmp * integration * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * update * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp * tmp
This commit is contained in:
31
lua/cmp/context_spec.lua
Normal file
31
lua/cmp/context_spec.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
local spec = require('cmp.utils.spec')
|
||||
|
||||
local context = require('cmp.context')
|
||||
|
||||
describe('context', function()
|
||||
before_each(spec.before)
|
||||
|
||||
describe('new', function()
|
||||
it('middle of text', function()
|
||||
vim.fn.setline('1', 'function! s:name() abort')
|
||||
vim.bo.filetype = 'vim'
|
||||
vim.fn.execute('normal! fm')
|
||||
local ctx = context.new()
|
||||
assert.are.equal(ctx.filetype, 'vim')
|
||||
assert.are.equal(ctx.cursor.row, 1)
|
||||
assert.are.equal(ctx.cursor.col, 15)
|
||||
assert.are.equal(ctx.cursor_line, 'function! s:name() abort')
|
||||
end)
|
||||
|
||||
it('tab indent', function()
|
||||
vim.fn.setline('1', '\t\tab')
|
||||
vim.bo.filetype = 'vim'
|
||||
vim.fn.execute('normal! fb')
|
||||
local ctx = context.new()
|
||||
assert.are.equal(ctx.filetype, 'vim')
|
||||
assert.are.equal(ctx.cursor.row, 1)
|
||||
assert.are.equal(ctx.cursor.col, 4)
|
||||
assert.are.equal(ctx.cursor_line, '\t\tab')
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user