aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-11-24 23:13:30 -0700
committerMichael Ennen <mike.ennen@gmail.com>2016-12-06 15:52:48 -0700
commit6fea2dfd26cb902d7b2f52f53ccca9befef2b442 (patch)
treea12933cbd0a18015e69221df92e7d9294ceaeb44 /src/nvim/testdir
parent61150294967f2522cb1774e29e49a3386d3bcee5 (diff)
downloadrneovim-6fea2dfd26cb902d7b2f52f53ccca9befef2b442.tar.gz
rneovim-6fea2dfd26cb902d7b2f52f53ccca9befef2b442.tar.bz2
rneovim-6fea2dfd26cb902d7b2f52f53ccca9befef2b442.zip
vim-patch:7.4.1685
Problem: There is no easy way to get all the information about a match. Solution: Add matchstrpos(). (Ozaki Kiichi) https://github.com/vim/vim/commit/7fed5c18f8577b75404b80d8b9a9907b1bbd27e4
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_matchstrpos.vim13
2 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim
index c9d7b332e4..58ed57499f 100644
--- a/src/nvim/testdir/test_alot.vim
+++ b/src/nvim/testdir/test_alot.vim
@@ -9,6 +9,7 @@ source test_expr.vim
source test_expr_utf8.vim
source test_feedkeys.vim
source test_goto.vim
+source test_matchstrpos.vim
source test_menu.vim
source test_messages.vim
source test_options.vim
diff --git a/src/nvim/testdir/test_matchstrpos.vim b/src/nvim/testdir/test_matchstrpos.vim
new file mode 100644
index 0000000000..e14765b26b
--- /dev/null
+++ b/src/nvim/testdir/test_matchstrpos.vim
@@ -0,0 +1,13 @@
+" Test matchstrpos
+
+func Test_matchstrpos()
+ call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing'))
+
+ call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2))
+
+ call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5))
+
+ call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing'))
+
+ call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img'))
+endfunc