diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-04-25 04:17:45 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-04-25 04:17:45 -0400 |
commit | ef205c3851fda637af49b5517bee60e6a62275ed (patch) | |
tree | a413274a5d7de9e1553ea475659dbad62e5ec0b8 /test | |
parent | 6f980346864251d2ed86d85c63fd6ec375e21edc (diff) | |
parent | 9e3ebb67119438d46eaceac739aca88880177060 (diff) | |
download | rneovim-ef205c3851fda637af49b5517bee60e6a62275ed.tar.gz rneovim-ef205c3851fda637af49b5517bee60e6a62275ed.tar.bz2 rneovim-ef205c3851fda637af49b5517bee60e6a62275ed.zip |
Merge pull request #4325 from watiko/vim-7.4.984
vim-patch:7.4.{984,1093}
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/searchpos_spec.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/legacy/searchpos_spec.lua b/test/functional/legacy/searchpos_spec.lua new file mode 100644 index 0000000000..1c9b1ccee6 --- /dev/null +++ b/test/functional/legacy/searchpos_spec.lua @@ -0,0 +1,35 @@ +local helpers = require('test.functional.helpers') +local call = helpers.call +local clear = helpers.clear +local execute = helpers.execute +local eq = helpers.eq +local eval = helpers.eval +local insert = helpers.insert + +describe('searchpos', function() + before_each(clear) + + it('is working', function() + insert([[ + 1a3 + 123xyz]]) + + call('cursor', 1, 1) + eq({1, 1, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]])) + call('cursor', 1, 2) + eq({2, 1, 1}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]])) + + execute('set cpo-=c') + call('cursor', 1, 2) + eq({1, 2, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]])) + call('cursor', 1, 3) + eq({1, 3, 1}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]])) + + -- Now with \zs, first match is in column 0, "a" is matched. + call('cursor', 1, 3) + eq({2, 4, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW')]])) + -- With z flag start at cursor column, don't see the "a". + call('cursor', 1, 3) + eq({2, 4, 1}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz')]])) + end) +end) |