neovim/test/functional/legacy/charsearch_spec.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.2 KiB
Lua
Raw Normal View History

2016-02-12 12:07:53 -07:00
-- Test for character searches
local helpers = require('test.functional.helpers')(after_each)
2016-02-12 12:07:53 -07:00
local feed, insert = helpers.feed, helpers.insert
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
2016-02-12 12:07:53 -07:00
describe('charsearch', function()
setup(clear)
it('is working', function()
insert([[
Xabcdefghijkemnopqretuvwxyz
Yabcdefghijkemnopqretuvwxyz
Zabcdefghijkemnokqretkvwxyz]])
-- Check that "fe" and ";" work.
feed_command('/^X')
2016-02-12 12:07:53 -07:00
feed('ylfep;;p,,p')
-- Check that save/restore works.
feed_command('/^Y')
2016-02-12 12:07:53 -07:00
feed('ylfep')
feed_command('let csave = getcharsearch()')
2016-02-12 12:07:53 -07:00
feed('fip')
feed_command('call setcharsearch(csave)')
2016-02-12 12:07:53 -07:00
feed(';p;p')
-- Check that setcharsearch() changes the settings.
feed_command('/^Z')
2016-02-12 12:07:53 -07:00
feed('ylfep')
feed_command("call setcharsearch({'char': 'k'})")
2016-02-12 12:07:53 -07:00
feed(';p')
feed_command("call setcharsearch({'forward': 0})")
2016-02-12 12:07:53 -07:00
feed('$;p')
feed_command("call setcharsearch({'until': 1})")
2016-02-12 12:07:53 -07:00
feed(';;p')
-- Assert buffer contents.
expect([[
XabcdeXfghijkeXmnopqreXtuvwxyz
YabcdeYfghiYjkeYmnopqreYtuvwxyz
ZabcdeZfghijkZZemnokqretkZvwxyz]])
2016-02-12 12:07:53 -07:00
end)
end)