aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorraichoo <raichoo@googlemail.com>2017-03-09 17:33:51 +0100
committerraichoo <raichoo@googlemail.com>2017-03-19 21:14:11 +0100
commit0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c (patch)
tree6ef5b9a051b32a9e8577150f2ab05f993a0fe07d /src/nvim/testdir
parent2ad25c04663da7d08da94db84dc6ded7df11ea87 (diff)
downloadrneovim-0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c.tar.gz
rneovim-0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c.tar.bz2
rneovim-0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c.zip
vim-patch:8.0.0179
Problem: 'formatprg' is a global option but the value may depend on the type of buffer. (Sung Pae) Solution: Make 'formatprg' global-local. (closes vim/vim#1380) https://github.com/vim/vim/commit/9be7c04e6cd5b0facedcb56b09a5bcfc339efe03
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_normal.vim32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim
index 29bd783ebc..98177851ab 100644
--- a/src/nvim/testdir/test_normal.vim
+++ b/src/nvim/testdir/test_normal.vim
@@ -224,21 +224,33 @@ func! Test_normal06_formatprg()
" only test on non windows platform
if has('win32')
return
- else
- " uses sed to number non-empty lines
- call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh')
- call system('chmod +x ./Xsed_format.sh')
endif
- call Setup_NewWindow()
- %d
- call setline(1, ['a', '', 'c', '', ' ', 'd', 'e'])
+
+ " uses sed to number non-empty lines
+ call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh')
+ call system('chmod +x ./Xsed_format.sh')
+ let text = ['a', '', 'c', '', ' ', 'd', 'e']
+ let expected = ['1 a', '', '3 c', '', '5 ', '6 d', '7 e']
+
+ 10new
+ call setline(1, text)
set formatprg=./Xsed_format.sh
norm! gggqG
- call assert_equal(['1 a', '', '3 c', '', '5 ', '6 d', '7 e'], getline(1, '$'))
+ call assert_equal(expected, getline(1, '$'))
+ bw!
+
+ 10new
+ call setline(1, text)
+ set formatprg=donothing
+ setlocal formatprg=./Xsed_format.sh
+ norm! gggqG
+ call assert_equal(expected, getline(1, '$'))
+ bw!
+
" clean up
set formatprg=
+ setlocal formatprg=
call delete('Xsed_format.sh')
- bw!
endfunc
func! Test_normal07_internalfmt()
@@ -251,7 +263,7 @@ func! Test_normal07_internalfmt()
norm! gggqG
call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$'))
" clean up
- set formatprg= tw=0
+ set tw=0
bw!
endfunc