Mercurial > vim
comparison src/testdir/test_normal.vim @ 10579:688b97124d23 v8.0.0179
patch 8.0.0179: cannot have a local value for 'formatprg'
commit https://github.com/vim/vim/commit/9be7c04e6cd5b0facedcb56b09a5bcfc339efe03
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 14 14:28:30 2017 +0100
patch 8.0.0179: cannot have a local value for 'formatprg'
Problem: 'formatprg' is a global option but the value may depend on the
type of buffer. (Sung Pae)
Solution: Make 'formatprg' global-local. (closes #1380)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 14 Jan 2017 14:30:04 +0100 |
parents | ae0faad76f9a |
children | 82c43bca568e |
comparison
equal
deleted
inserted
replaced
10578:6bdfba1a1ee2 | 10579:688b97124d23 |
---|---|
222 func! Test_normal06_formatprg() | 222 func! Test_normal06_formatprg() |
223 " basic test for formatprg | 223 " basic test for formatprg |
224 " only test on non windows platform | 224 " only test on non windows platform |
225 if has('win32') | 225 if has('win32') |
226 return | 226 return |
227 else | |
228 " uses sed to number non-empty lines | |
229 call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh') | |
230 call system('chmod +x ./Xsed_format.sh') | |
231 endif | 227 endif |
232 call Setup_NewWindow() | 228 |
233 %d | 229 " uses sed to number non-empty lines |
234 call setline(1, ['a', '', 'c', '', ' ', 'd', 'e']) | 230 call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh') |
231 call system('chmod +x ./Xsed_format.sh') | |
232 let text = ['a', '', 'c', '', ' ', 'd', 'e'] | |
233 let expected = ['1 a', '', '3 c', '', '5 ', '6 d', '7 e'] | |
234 | |
235 10new | |
236 call setline(1, text) | |
235 set formatprg=./Xsed_format.sh | 237 set formatprg=./Xsed_format.sh |
236 norm! gggqG | 238 norm! gggqG |
237 call assert_equal(['1 a', '', '3 c', '', '5 ', '6 d', '7 e'], getline(1, '$')) | 239 call assert_equal(expected, getline(1, '$')) |
240 bw! | |
241 | |
242 10new | |
243 call setline(1, text) | |
244 set formatprg=donothing | |
245 setlocal formatprg=./Xsed_format.sh | |
246 norm! gggqG | |
247 call assert_equal(expected, getline(1, '$')) | |
248 bw! | |
249 | |
238 " clean up | 250 " clean up |
239 set formatprg= | 251 set formatprg= |
252 setlocal formatprg= | |
240 call delete('Xsed_format.sh') | 253 call delete('Xsed_format.sh') |
241 bw! | |
242 endfunc | 254 endfunc |
243 | 255 |
244 func! Test_normal07_internalfmt() | 256 func! Test_normal07_internalfmt() |
245 " basic test for internal formmatter to textwidth of 12 | 257 " basic test for internal formmatter to textwidth of 12 |
246 let list=range(1,11) | 258 let list=range(1,11) |
249 call setline(1, list) | 261 call setline(1, list) |
250 set tw=12 | 262 set tw=12 |
251 norm! gggqG | 263 norm! gggqG |
252 call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$')) | 264 call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$')) |
253 " clean up | 265 " clean up |
254 set formatprg= tw=0 | 266 set tw=0 |
255 bw! | 267 bw! |
256 endfunc | 268 endfunc |
257 | 269 |
258 func! Test_normal08_fold() | 270 func! Test_normal08_fold() |
259 " basic tests for foldopen/folddelete | 271 " basic tests for foldopen/folddelete |