diff options
author | James McCoy <jamessan@jamessan.com> | 2016-10-20 09:40:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-20 09:40:07 -0400 |
commit | 978c1fd11fa9709593f4e0539fda7d572c73b9d6 (patch) | |
tree | 772c7cbb9cfb9a3c81f956cdad9b3758a4e9273a | |
parent | e19234f391f7dc9259dbd1115a70868e3b54577d (diff) | |
parent | 73da9fdafddfe861bc2afdc300be1d4bc810cf7d (diff) | |
download | rneovim-978c1fd11fa9709593f4e0539fda7d572c73b9d6.tar.gz rneovim-978c1fd11fa9709593f4e0539fda7d572c73b9d6.tar.bz2 rneovim-978c1fd11fa9709593f4e0539fda7d572c73b9d6.zip |
Merge pull request #5503 from jamessan/vim-7.4.1494
vim-patch:7.4.1494
-rw-r--r-- | src/nvim/ex_getln.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_history.vim | 65 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 68 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 4254697241..7444eb8a38 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4396,6 +4396,7 @@ static HistoryType hist_char2type(const int c) case '>': { return HIST_DEBUG; } + case NUL: case '/': case '?': { return HIST_SEARCH; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 4d21887240..67e7c97905 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -34,6 +34,7 @@ NEW_TESTS = \ test_cscope.res \ test_hardcopy.res \ test_help_tagjump.res \ + test_history.res \ test_langmap.res \ test_syntax.res \ test_usercommands.res \ diff --git a/src/nvim/testdir/test_history.vim b/src/nvim/testdir/test_history.vim new file mode 100644 index 0000000000..ee6acfffc3 --- /dev/null +++ b/src/nvim/testdir/test_history.vim @@ -0,0 +1,65 @@ +" Tests for the history functions + +if !has('cmdline_hist') + finish +endif + +set history=7 + +function History_Tests(hist) + " First clear the history + call histadd(a:hist, 'dummy') + call assert_true(histdel(a:hist)) + call assert_equal(-1, histnr(a:hist)) + call assert_equal('', histget(a:hist)) + + call assert_true(histadd(a:hist, 'ls')) + call assert_true(histadd(a:hist, 'buffers')) + call assert_equal('buffers', histget(a:hist)) + call assert_equal('ls', histget(a:hist, -2)) + call assert_equal('ls', histget(a:hist, 1)) + call assert_equal('', histget(a:hist, 5)) + call assert_equal('', histget(a:hist, -5)) + call assert_equal(2, histnr(a:hist)) + call assert_true(histdel(a:hist, 2)) + call assert_false(histdel(a:hist, 7)) + call assert_equal(1, histnr(a:hist)) + call assert_equal('ls', histget(a:hist, -1)) + + call assert_true(histadd(a:hist, 'buffers')) + call assert_true(histadd(a:hist, 'ls')) + call assert_equal('ls', histget(a:hist, -1)) + call assert_equal(4, histnr(a:hist)) + + " Test for removing entries matching a pattern + for i in range(1, 3) + call histadd(a:hist, 'text_' . i) + endfor + call assert_true(histdel(a:hist, 'text_\d\+')) + call assert_equal('ls', histget(a:hist, -1)) + + " Test for freeing the entire history list + for i in range(1, 7) + call histadd(a:hist, 'text_' . i) + endfor + call histdel(a:hist) + for i in range(1, 7) + call assert_equal('', histget(a:hist, i)) + call assert_equal('', histget(a:hist, i - 7 - 1)) + endfor +endfunction + +function Test_History() + for h in ['cmd', ':', '', 'search', '/', '?', 'expr', '=', 'input', '@', 'debug', '>'] + call History_Tests(h) + endfor + + " Negative tests + call assert_false(histdel('abc')) + call assert_equal('', histget('abc')) + call assert_fails('call histdel([])', 'E730:') + call assert_equal('', histget(10)) + call assert_fails('call histget([])', 'E730:') + call assert_equal(-1, histnr('abc')) + call assert_fails('call histnr([])', 'E730:') +endfunction diff --git a/src/nvim/version.c b/src/nvim/version.c index 0bc55df585..61fef32b23 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -949,7 +949,7 @@ static int included_patches[] = { // 1497 NA // 1496 NA // 1495 NA - // 1494, + 1494, // 1493 NA 1492, 1491, |