diff src/testdir/test_normal.vim @ 20261:aafedd368f40 v8.2.0686

patch 8.2.0686: formatoptions not sufficiently tested Commit: https://github.com/vim/vim/commit/2eaeaf3c317a5145fb0bc926411561d50883019b Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 3 16:04:43 2020 +0200 patch 8.2.0686: formatoptions not sufficiently tested Problem: Formatoptions not sufficiently tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6031)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 May 2020 16:15:03 +0200
parents a4bd28e2cf1d
children 045442aa392b
line wrap: on
line diff
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -204,6 +204,21 @@ func Test_normal05_formatexpr_setopt()
   set formatexpr=
 endfunc
 
+" When 'formatexpr' returns non-zero, internal formatting is used.
+func Test_normal_formatexpr_returns_nonzero()
+  new
+  call setline(1, ['one', 'two'])
+  func! Format()
+    return 1
+  endfunc
+  setlocal formatexpr=Format()
+  normal VGgq
+  call assert_equal(['one two'], getline(1, '$'))
+  setlocal formatexpr=
+  delfunc Format
+  close!
+endfunc
+
 " basic test for formatprg
 func Test_normal06_formatprg()
   " only test on non windows platform