From 6ed201c5b5ffd406aa9813aa3c4598ce33a07abb Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Tue, 12 Apr 2016 19:50:53 +0200 Subject: [PATCH] vim-patch:7.4.1259 Problem: No test for what patch 7.3.414 fixed. Solution: Add a test. (Elias Diem) https://github.com/vim/vim/commit/3fc3e14282c182c046d1335f3d576bc0eeb605c5 --- src/nvim/version.c | 2 +- test/functional/legacy/increment_spec.lua | 25 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/nvim/version.c b/src/nvim/version.c index 81137ff1c6..16081d41a0 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -419,7 +419,7 @@ static int included_patches[] = { // 1262 NA // 1261 NA // 1260 NA - // 1259, + 1259, // 1258 NA // 1257 NA // 1256 NA diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua index 6139ec0b67..4aa24c0d53 100644 --- a/test/functional/legacy/increment_spec.lua +++ b/test/functional/legacy/increment_spec.lua @@ -708,6 +708,25 @@ describe('Ctrl-A/Ctrl-X on visual selections', function() call assert_equal(["20"], getline(1, '$')) call assert_equal([0, 1, 2, 0], getpos('.')) endfunc + + " Test what patch 7.3.414 fixed. Ctrl-A on "000" drops the leading zeros. + func Test_normal_increment_01() + call setline(1, "000") + exec "norm! gg0\" + call assert_equal("001", getline(1)) + + call setline(1, "000") + exec "norm! gg$\" + call assert_equal("001", getline(1)) + + call setline(1, "001") + exec "norm! gg0\" + call assert_equal("002", getline(1)) + + call setline(1, "001") + exec "norm! gg$\" + call assert_equal("002", getline(1)) + endfunc ]=]) end) @@ -720,4 +739,10 @@ describe('Ctrl-A/Ctrl-X on visual selections', function() eq({}, nvim.get_vvar('errors')) end) end + + it('does not drop leading zeroes', function() + execute('set nrformats&vi') -- &vi makes Vim compatible + call('Test_normal_increment_01') + eq({}, nvim.get_vvar('errors')) + end) end)